@@ -199,7 +199,7 @@ public function get($name)
199
199
return $ this ->services [$ requestedName ];
200
200
}
201
201
202
- $ name = isset ( $ this ->resolvedAliases [$ name ]) ? $ this -> resolvedAliases [ $ name ] : $ name ;
202
+ $ name = $ this ->resolvedAliases [$ name ] ?? $ name ;
203
203
204
204
// Next, if the alias should be shared, and we have cached the resolved
205
205
// service, use it.
@@ -239,7 +239,7 @@ public function get($name)
239
239
public function build ($ name , array $ options = null )
240
240
{
241
241
// We never cache when using "build"
242
- $ name = isset ( $ this ->resolvedAliases [$ name ]) ? $ this -> resolvedAliases [ $ name ] : $ name ;
242
+ $ name = $ this ->resolvedAliases [$ name ] ?? $ name ;
243
243
return $ this ->doCreate ($ name , $ options );
244
244
}
245
245
@@ -248,7 +248,7 @@ public function build($name, array $options = null)
248
248
*/
249
249
public function has ($ name )
250
250
{
251
- $ name = isset ( $ this ->resolvedAliases [$ name ]) ? $ this -> resolvedAliases [ $ name ] : $ name ;
251
+ $ name = $ this ->resolvedAliases [$ name ] ?? $ name ;
252
252
$ found = isset ($ this ->services [$ name ]) || isset ($ this ->factories [$ name ]);
253
253
254
254
if ($ found ) {
@@ -339,12 +339,12 @@ public function configure(array $config)
339
339
340
340
if (! empty ($ aliases )) {
341
341
$ config ['aliases ' ] = (isset ($ config ['aliases ' ]))
342
- ? array_merge ($ config ['aliases ' ], $ aliases )
342
+ ? \ array_merge ($ config ['aliases ' ], $ aliases )
343
343
: $ aliases ;
344
344
}
345
345
346
346
$ config ['factories ' ] = (isset ($ config ['factories ' ]))
347
- ? array_merge ($ config ['factories ' ], $ factories )
347
+ ? \ array_merge ($ config ['factories ' ], $ factories )
348
348
: $ factories ;
349
349
}
350
350
@@ -353,7 +353,7 @@ public function configure(array $config)
353
353
}
354
354
355
355
if (isset ($ config ['delegators ' ])) {
356
- $ this ->delegators = array_merge_recursive ($ this ->delegators , $ config ['delegators ' ]);
356
+ $ this ->delegators = \ array_merge_recursive ($ this ->delegators , $ config ['delegators ' ]);
357
357
}
358
358
359
359
if (isset ($ config ['shared ' ])) {
@@ -373,7 +373,7 @@ public function configure(array $config)
373
373
// If lazy service configuration was provided, reset the lazy services
374
374
// delegator factory.
375
375
if (isset ($ config ['lazy_services ' ]) && ! empty ($ config ['lazy_services ' ])) {
376
- $ this ->lazyServices = array_merge_recursive ($ this ->lazyServices , $ config ['lazy_services ' ]);
376
+ $ this ->lazyServices = \ array_merge_recursive ($ this ->lazyServices , $ config ['lazy_services ' ]);
377
377
$ this ->lazyServicesDelegator = null ;
378
378
}
379
379
@@ -532,7 +532,7 @@ public function setShared($name, $flag)
532
532
private function resolveAbstractFactories (array $ abstractFactories )
533
533
{
534
534
foreach ($ abstractFactories as $ abstractFactory ) {
535
- if (is_string ($ abstractFactory ) && class_exists ($ abstractFactory )) {
535
+ if (\ is_string ($ abstractFactory ) && \ class_exists ($ abstractFactory )) {
536
536
//Cached string
537
537
if (! isset ($ this ->cachedAbstractFactories [$ abstractFactory ])) {
538
538
$ this ->cachedAbstractFactories [$ abstractFactory ] = new $ abstractFactory ();
@@ -542,15 +542,15 @@ private function resolveAbstractFactories(array $abstractFactories)
542
542
}
543
543
544
544
if ($ abstractFactory instanceof Factory \AbstractFactoryInterface) {
545
- $ abstractFactoryObjHash = spl_object_hash ($ abstractFactory );
545
+ $ abstractFactoryObjHash = \ spl_object_hash ($ abstractFactory );
546
546
$ this ->abstractFactories [$ abstractFactoryObjHash ] = $ abstractFactory ;
547
547
continue ;
548
548
}
549
549
550
550
// Error condition; let's find out why.
551
551
552
552
// If we still have a string, we have a class name that does not resolve
553
- if (is_string ($ abstractFactory )) {
553
+ if (\ is_string ($ abstractFactory )) {
554
554
throw new InvalidArgumentException (
555
555
sprintf (
556
556
'An invalid abstract factory was registered; resolved to class "%s" ' .
@@ -584,18 +584,18 @@ private function resolveAbstractFactories(array $abstractFactories)
584
584
private function resolveInitializers (array $ initializers )
585
585
{
586
586
foreach ($ initializers as $ initializer ) {
587
- if (is_string ($ initializer ) && class_exists ($ initializer )) {
587
+ if (\ is_string ($ initializer ) && \ class_exists ($ initializer )) {
588
588
$ initializer = new $ initializer ();
589
589
}
590
590
591
- if (is_callable ($ initializer )) {
591
+ if (\ is_callable ($ initializer )) {
592
592
$ this ->initializers [] = $ initializer ;
593
593
continue ;
594
594
}
595
595
596
596
// Error condition; let's find out why.
597
597
598
- if (is_string ($ initializer )) {
598
+ if (\ is_string ($ initializer )) {
599
599
throw new InvalidArgumentException (
600
600
sprintf (
601
601
'An invalid initializer was registered; resolved to class or function "%s" ' .
@@ -672,15 +672,15 @@ private function resolveNewAliasesWithPreviouslyResolvedAliases(array $aliases)
672
672
*/
673
673
private function getFactory ($ name )
674
674
{
675
- $ factory = isset ( $ this ->factories [$ name ]) ? $ this -> factories [ $ name ] : null ;
675
+ $ factory = $ this ->factories [$ name ] ?? null ;
676
676
677
677
$ lazyLoaded = false ;
678
- if (is_string ($ factory ) && class_exists ($ factory )) {
678
+ if (\ is_string ($ factory ) && \ class_exists ($ factory )) {
679
679
$ factory = new $ factory ();
680
680
$ lazyLoaded = true ;
681
681
}
682
682
683
- if (is_callable ($ factory )) {
683
+ if (\ is_callable ($ factory )) {
684
684
if ($ lazyLoaded ) {
685
685
$ this ->factories [$ name ] = $ factory ;
686
686
}
@@ -720,13 +720,13 @@ private function createDelegatorFromName($name, array $options = null)
720
720
$ delegatorFactory = $ this ->createLazyServiceDelegatorFactory ();
721
721
}
722
722
723
- if (is_string ($ delegatorFactory ) && class_exists ($ delegatorFactory )) {
723
+ if (\ is_string ($ delegatorFactory ) && \ class_exists ($ delegatorFactory )) {
724
724
$ delegatorFactory = new $ delegatorFactory ();
725
725
}
726
726
727
- if (! is_callable ($ delegatorFactory )) {
728
- if (is_string ($ delegatorFactory )) {
729
- throw new ServiceNotCreatedException (sprintf (
727
+ if (! \ is_callable ($ delegatorFactory )) {
728
+ if (\ is_string ($ delegatorFactory )) {
729
+ throw new ServiceNotCreatedException (\ sprintf (
730
730
'An invalid delegator factory was registered; resolved to class or function "%s" '
731
731
. 'which does not exist; please provide a valid function name or class name resolving '
732
732
. 'to an implementation of %s ' ,
@@ -735,9 +735,9 @@ private function createDelegatorFromName($name, array $options = null)
735
735
));
736
736
}
737
737
738
- throw new ServiceNotCreatedException (sprintf (
738
+ throw new ServiceNotCreatedException (\ sprintf (
739
739
'A non-callable delegator, "%s", was provided; expected a callable or instance of "%s" ' ,
740
- is_object ($ delegatorFactory ) ? get_class ($ delegatorFactory ) : gettype ($ delegatorFactory ),
740
+ \ is_object ($ delegatorFactory ) ? \ get_class ($ delegatorFactory ) : \ gettype ($ delegatorFactory ),
741
741
DelegatorFactoryInterface::class
742
742
));
743
743
}
@@ -830,7 +830,7 @@ private function createLazyServiceDelegatorFactory()
830
830
));
831
831
}
832
832
833
- spl_autoload_register ($ factoryConfig ->getProxyAutoloader ());
833
+ \ spl_autoload_register ($ factoryConfig ->getProxyAutoloader ());
834
834
835
835
$ this ->lazyServicesDelegator = new Proxy \LazyServiceFactory (
836
836
new LazyLoadingValueHolderFactory ($ factoryConfig ),
@@ -908,31 +908,31 @@ private function validateOverrides(array $config)
908
908
}
909
909
910
910
if (isset ($ config ['services ' ])) {
911
- $ this ->validateOverrideSet (array_keys ($ config ['services ' ]), 'service ' );
911
+ $ this ->validateOverrideSet (\ array_keys ($ config ['services ' ]), 'service ' );
912
912
}
913
913
914
914
if (isset ($ config ['aliases ' ])) {
915
- $ this ->validateOverrideSet (array_keys ($ config ['aliases ' ]), 'alias ' );
915
+ $ this ->validateOverrideSet (\ array_keys ($ config ['aliases ' ]), 'alias ' );
916
916
}
917
917
918
918
if (isset ($ config ['invokables ' ])) {
919
- $ this ->validateOverrideSet (array_keys ($ config ['invokables ' ]), 'invokable class ' );
919
+ $ this ->validateOverrideSet (\ array_keys ($ config ['invokables ' ]), 'invokable class ' );
920
920
}
921
921
922
922
if (isset ($ config ['factories ' ])) {
923
- $ this ->validateOverrideSet (array_keys ($ config ['factories ' ]), 'factory ' );
923
+ $ this ->validateOverrideSet (\ array_keys ($ config ['factories ' ]), 'factory ' );
924
924
}
925
925
926
926
if (isset ($ config ['delegators ' ])) {
927
- $ this ->validateOverrideSet (array_keys ($ config ['delegators ' ]), 'delegator ' );
927
+ $ this ->validateOverrideSet (\ array_keys ($ config ['delegators ' ]), 'delegator ' );
928
928
}
929
929
930
930
if (isset ($ config ['shared ' ])) {
931
- $ this ->validateOverrideSet (array_keys ($ config ['shared ' ]), 'sharing rule ' );
931
+ $ this ->validateOverrideSet (\ array_keys ($ config ['shared ' ]), 'sharing rule ' );
932
932
}
933
933
934
934
if (isset ($ config ['lazy_services ' ]['class_map ' ])) {
935
- $ this ->validateOverrideSet (array_keys ($ config ['lazy_services ' ]['class_map ' ]), 'lazy service ' );
935
+ $ this ->validateOverrideSet (\ array_keys ($ config ['lazy_services ' ]['class_map ' ]), 'lazy service ' );
936
936
}
937
937
}
938
938
0 commit comments