2828 */
2929class AutowirePass extends AbstractRecursivePass
3030{
31- private $ definedTypes = array () ;
31+ private $ definedTypes = [] ;
3232 private $ types ;
3333 private $ ambiguousServiceTypes ;
34- private $ autowired = array () ;
34+ private $ autowired = [] ;
3535 private $ lastFailure ;
3636 private $ throwOnAutowiringException ;
37- private $ autowiringExceptions = array () ;
37+ private $ autowiringExceptions = [] ;
3838 private $ strictMode ;
3939
4040 /**
@@ -63,16 +63,16 @@ public function getAutowiringExceptions()
6363 public function process (ContainerBuilder $ container )
6464 {
6565 // clear out any possibly stored exceptions from before
66- $ this ->autowiringExceptions = array () ;
66+ $ this ->autowiringExceptions = [] ;
6767 $ this ->strictMode = $ container ->hasParameter ('container.autowiring.strict_mode ' ) && $ container ->getParameter ('container.autowiring.strict_mode ' );
6868
6969 try {
7070 parent ::process ($ container );
7171 } finally {
72- $ this ->definedTypes = array () ;
72+ $ this ->definedTypes = [] ;
7373 $ this ->types = null ;
7474 $ this ->ambiguousServiceTypes = null ;
75- $ this ->autowired = array () ;
75+ $ this ->autowired = [] ;
7676 }
7777 }
7878
@@ -89,7 +89,7 @@ public static function createResourceForClass(\ReflectionClass $reflectionClass)
8989 {
9090 @trigger_error ('The ' .__METHOD__ .'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead. ' , E_USER_DEPRECATED );
9191
92- $ metadata = array () ;
92+ $ metadata = [] ;
9393
9494 foreach ($ reflectionClass ->getMethods (\ReflectionMethod::IS_PUBLIC ) as $ reflectionMethod ) {
9595 if (!$ reflectionMethod ->isStatic ()) {
@@ -147,7 +147,7 @@ private function doProcessValue($value, $isRoot = false)
147147 }
148148
149149 if ($ constructor ) {
150- array_unshift ($ methodCalls , array ( $ constructor , $ value ->getArguments ()) );
150+ array_unshift ($ methodCalls , [ $ constructor , $ value ->getArguments ()] );
151151 }
152152
153153 $ methodCalls = $ this ->autowireCalls ($ reflectionClass , $ methodCalls );
@@ -327,9 +327,9 @@ private function getAutowiredReference(TypedReference $reference, $deprecationMe
327327 */
328328 private function populateAvailableTypes ($ onlyAutowiringTypes = false )
329329 {
330- $ this ->types = array () ;
330+ $ this ->types = [] ;
331331 if (!$ onlyAutowiringTypes ) {
332- $ this ->ambiguousServiceTypes = array () ;
332+ $ this ->ambiguousServiceTypes = [] ;
333333 }
334334
335335 foreach ($ this ->container ->getDefinitions () as $ id => $ definition ) {
@@ -401,7 +401,7 @@ private function set($type, $id)
401401
402402 // keep an array of all services matching this type
403403 if (!isset ($ this ->ambiguousServiceTypes [$ type ])) {
404- $ this ->ambiguousServiceTypes [$ type ] = array ( $ this ->types [$ type ]) ;
404+ $ this ->ambiguousServiceTypes [$ type ] = [ $ this ->types [$ type ]] ;
405405 unset($ this ->types [$ type ]);
406406 }
407407 $ this ->ambiguousServiceTypes [$ type ][] = $ id ;
@@ -521,7 +521,7 @@ private function createTypeAlternatives(TypedReference $reference)
521521 */
522522 private static function getResourceMetadataForMethod (\ReflectionMethod $ method )
523523 {
524- $ methodArgumentsMetadata = array () ;
524+ $ methodArgumentsMetadata = [] ;
525525 foreach ($ method ->getParameters () as $ parameter ) {
526526 try {
527527 $ class = $ parameter ->getClass ();
@@ -531,19 +531,19 @@ private static function getResourceMetadataForMethod(\ReflectionMethod $method)
531531 }
532532
533533 $ isVariadic = method_exists ($ parameter , 'isVariadic ' ) && $ parameter ->isVariadic ();
534- $ methodArgumentsMetadata [] = array (
534+ $ methodArgumentsMetadata [] = [
535535 'class ' => $ class ,
536536 'isOptional ' => $ parameter ->isOptional (),
537537 'defaultValue ' => ($ parameter ->isOptional () && !$ isVariadic ) ? $ parameter ->getDefaultValue () : null ,
538- ) ;
538+ ] ;
539539 }
540540
541541 return $ methodArgumentsMetadata ;
542542 }
543543
544544 private function getAliasesSuggestionForType ($ type , $ extraContext = null )
545545 {
546- $ aliases = array () ;
546+ $ aliases = [] ;
547547 foreach (class_parents ($ type ) + class_implements ($ type ) as $ parent ) {
548548 if ($ this ->container ->has ($ parent ) && !$ this ->container ->findDefinition ($ parent )->isAbstract ()) {
549549 $ aliases [] = $ parent ;
0 commit comments