@@ -100,6 +100,8 @@ class Factories
100100 */
101101 public static function define (string $ component , string $ alias , string $ classname ): void
102102 {
103+ $ component = strtolower ($ component );
104+
103105 if (isset (self ::$ aliases [$ component ][$ alias ])) {
104106 if (self ::$ aliases [$ component ][$ alias ] === $ classname ) {
105107 return ;
@@ -130,12 +132,14 @@ public static function define(string $component, string $alias, string $classnam
130132 */
131133 public static function __callStatic (string $ component , array $ arguments )
132134 {
135+ $ component = strtolower ($ component );
136+
133137 // First argument is the class alias, second is options
134138 $ alias = trim (array_shift ($ arguments ), '\\ ' );
135139 $ options = array_shift ($ arguments ) ?? [];
136140
137141 // Determine the component-specific options
138- $ options = array_merge (self ::getOptions (strtolower ( $ component) ), $ options );
142+ $ options = array_merge (self ::getOptions ($ component ), $ options );
139143
140144 if (! $ options ['getShared ' ]) {
141145 if (isset (self ::$ aliases [$ component ][$ alias ])) {
@@ -394,6 +398,8 @@ public static function getOptions(string $component): array
394398 */
395399 public static function setOptions (string $ component , array $ values ): array
396400 {
401+ $ component = strtolower ($ component );
402+
397403 // Allow the config to replace the component name, to support "aliases"
398404 $ values ['component ' ] = strtolower ($ values ['component ' ] ?? $ component );
399405
@@ -452,8 +458,9 @@ public static function reset(?string $component = null)
452458 */
453459 public static function injectMock (string $ component , string $ alias , object $ instance )
454460 {
455- // Force a configuration to exist for this component
456461 $ component = strtolower ($ component );
462+
463+ // Force a configuration to exist for this component
457464 self ::getOptions ($ component );
458465
459466 $ class = get_class ($ instance );
0 commit comments