@@ -52,10 +52,14 @@ class Factories
5252 ];
5353
5454 /**
55- * Mapping of classnames (with or without namespace) to
56- * their instances.
55+ * Mapping of class aliases to their true Full Qualified Class Name (FQCN).
5756 *
58- * [component => [name => FQCN]]
57+ * Class aliases can be:
58+ * - FQCN. E.g., 'App\Lib\SomeLib'
59+ * - short classname. E.g., 'SomeLib'
60+ * - short classname with sub-directories. E.g., 'Sub/SomeLib'
61+ *
62+ * [component => [alias => FQCN]]
5963 *
6064 * @var array<string, array<string, string>>
6165 * @phpstan-var array<string, array<string, class-string>>
@@ -65,6 +69,7 @@ class Factories
6569 /**
6670 * Store for instances of any component that
6771 * has been requested as "shared".
72+ *
6873 * A multi-dimensional array with components as
6974 * keys to the array of name-indexed instances.
7075 *
@@ -79,7 +84,7 @@ class Factories
7984 * Define the class to load. You can *override* the concrete class.
8085 *
8186 * @param string $component Lowercase, plural component name
82- * @param string $name Classname. The first parameter of Factories magic method
87+ * @param string $name Class alias. See the $basenames property.
8388 * @param string $classname FQCN to load
8489 * @phpstan-param class-string $classname FQCN to load
8590 */
@@ -114,7 +119,7 @@ public static function define(string $component, string $name, string $classname
114119 */
115120 public static function __callStatic (string $ component , array $ arguments )
116121 {
117- // First argument is the name , second is options
122+ // First argument is the class alias , second is options
118123 $ name = trim (array_shift ($ arguments ), '\\ ' );
119124 $ options = array_shift ($ arguments ) ?? [];
120125
@@ -200,7 +205,7 @@ private static function isConfig(string $component): bool
200205 * Finds a component class
201206 *
202207 * @param array $options The array of component-specific directives
203- * @param string $name Class name, namespace optional
208+ * @param string $name Class alias. See the $basenames property.
204209 */
205210 protected static function locateClass (array $ options , string $ name ): ?string
206211 {
@@ -266,7 +271,7 @@ class_exists($name, false)
266271 * Verifies that a class & config satisfy the "preferApp" option
267272 *
268273 * @param array $options The array of component-specific directives
269- * @param string $name Class name, namespace optional
274+ * @param string $name Class alias. See the $basenames property.
270275 */
271276 protected static function verifyPreferApp (array $ options , string $ name ): bool
272277 {
@@ -287,7 +292,7 @@ protected static function verifyPreferApp(array $options, string $name): bool
287292 * Verifies that a class & config satisfy the "instanceOf" option
288293 *
289294 * @param array $options The array of component-specific directives
290- * @param string $name Class name, namespace optional
295+ * @param string $name Class alias. See the $basenames property.
291296 */
292297 protected static function verifyInstanceOf (array $ options , string $ name ): bool
293298 {
@@ -383,7 +388,7 @@ public static function reset(?string $component = null)
383388 * Helper method for injecting mock instances
384389 *
385390 * @param string $component Lowercase, plural component name
386- * @param string $name The name of the instance
391+ * @param string $name Class alias. See the $basenames property.
387392 *
388393 * @internal For testing only
389394 */
0 commit comments