@@ -223,11 +223,11 @@ public function dump(array $options = [])
223223 }
224224 if ($ ids = array_keys ($ ids )) {
225225 sort ($ ids );
226- $ c = "<?php \n\nreturn array( \n" ;
226+ $ c = "<?php \n\nreturn [ \n" ;
227227 foreach ($ ids as $ id ) {
228228 $ c .= ' ' .$ this ->doExport ($ id )." => true, \n" ;
229229 }
230- $ files ['removed-ids.php ' ] = $ c .= ") ; \n" ;
230+ $ files ['removed-ids.php ' ] = $ c .= "] ; \n" ;
231231 }
232232
233233 foreach ($ this ->generateServiceFiles () as $ file => $ c ) {
@@ -266,11 +266,11 @@ public function dump(array $options = [])
266266 \\class_alias(\\Container {$ hash }\\ {$ options ['class ' ]}::class, {$ options ['class ' ]}::class, false);
267267}
268268
269- return new \\Container {$ hash }\\ {$ options ['class ' ]}(array(
269+ return new \\Container {$ hash }\\ {$ options ['class ' ]}([
270270 'container.build_hash' => ' $ hash',
271271 'container.build_id' => ' $ id',
272272 'container.build_time' => $ time,
273- ) , __DIR__.\\DIRECTORY_SEPARATOR.'Container {$ hash }');
273+ ] , __DIR__.\\DIRECTORY_SEPARATOR.'Container {$ hash }');
274274
275275EOF ;
276276 } else {
@@ -913,12 +913,12 @@ private function startClass(string $class, string $baseClass, string $baseClassW
913913class $ class extends $ baseClass
914914{
915915 private \$parameters;
916- private \$targetDirs = array() ;
916+ private \$targetDirs = [] ;
917917
918918 /* {$ this ->docStar }
919919 * @internal but protected for BC on cache:clear
920920 */
921- protected \$privates = array() ;
921+ protected \$privates = [] ;
922922
923923 public function __construct()
924924 {
@@ -936,7 +936,7 @@ public function __construct()
936936 }
937937 if ($ this ->asFiles ) {
938938 $ code = str_replace ('$parameters ' , "\$buildParameters; \n private \$containerDir; \n private \$parameters " , $ code );
939- $ code = str_replace ('__construct() ' , '__construct(array $buildParameters = array() , $containerDir = __DIR__) ' , $ code );
939+ $ code = str_replace ('__construct() ' , '__construct(array $buildParameters = [] , $containerDir = __DIR__) ' , $ code );
940940 $ code .= " \$this->buildParameters = \$buildParameters; \n" ;
941941 $ code .= " \$this->containerDir = \$containerDir; \n" ;
942942 }
@@ -956,7 +956,7 @@ public function __construct()
956956 if ($ this ->container ->getParameterBag ()->all ()) {
957957 $ code .= " \$this->parameters = \$this->getDefaultParameters(); \n\n" ;
958958 }
959- $ code .= " \$this->services = \$this->privates = array() ; \n" ;
959+ $ code .= " \$this->services = \$this->privates = [] ; \n" ;
960960
961961 $ code .= $ this ->addSyntheticIds ();
962962 $ code .= $ this ->addMethodMap ();
@@ -968,7 +968,7 @@ public function __construct()
968968
969969 public function reset()
970970 {
971- \$this->privates = array() ;
971+ \$this->privates = [] ;
972972 parent::reset();
973973 }
974974
@@ -1036,7 +1036,7 @@ private function addSyntheticIds(): string
10361036 }
10371037 }
10381038
1039- return $ code ? " \$this->syntheticIds = array( \n{$ code } ) ; \n" : '' ;
1039+ return $ code ? " \$this->syntheticIds = [ \n{$ code } ] ; \n" : '' ;
10401040 }
10411041
10421042 private function addRemovedIds (): string
@@ -1063,7 +1063,7 @@ private function addRemovedIds(): string
10631063 $ code .= ' ' .$ this ->doExport ($ id )." => true, \n" ;
10641064 }
10651065
1066- $ code = "array( \n{$ code } ) " ;
1066+ $ code = "[ \n{$ code } ] " ;
10671067 }
10681068
10691069 return <<<EOF
@@ -1087,7 +1087,7 @@ private function addMethodMap(): string
10871087 }
10881088 }
10891089
1090- return $ code ? " \$this->methodMap = array( \n{$ code } ) ; \n" : '' ;
1090+ return $ code ? " \$this->methodMap = [ \n{$ code } ] ; \n" : '' ;
10911091 }
10921092
10931093 private function addFileMap (): string
@@ -1101,16 +1101,16 @@ private function addFileMap(): string
11011101 }
11021102 }
11031103
1104- return $ code ? " \$this->fileMap = array( \n{$ code } ) ; \n" : '' ;
1104+ return $ code ? " \$this->fileMap = [ \n{$ code } ] ; \n" : '' ;
11051105 }
11061106
11071107 private function addAliases (): string
11081108 {
11091109 if (!$ aliases = $ this ->container ->getAliases ()) {
1110- return "\n \$this->aliases = array() ; \n" ;
1110+ return "\n \$this->aliases = [] ; \n" ;
11111111 }
11121112
1113- $ code = " \$this->aliases = array( \n" ;
1113+ $ code = " \$this->aliases = [ \n" ;
11141114 ksort ($ aliases );
11151115 foreach ($ aliases as $ alias => $ id ) {
11161116 $ id = (string ) $ id ;
@@ -1120,7 +1120,7 @@ private function addAliases(): string
11201120 $ code .= ' ' .$ this ->doExport ($ alias ).' => ' .$ this ->doExport ($ id ).", \n" ;
11211121 }
11221122
1123- return $ code ." ) ; \n" ;
1123+ return $ code ." ] ; \n" ;
11241124 }
11251125
11261126 private function addInlineRequires (): string
@@ -1168,15 +1168,16 @@ private function addDefaultParametersMethod(): string
11681168 throw new InvalidArgumentException (sprintf ('Parameter name cannot use env parameters: %s. ' , $ resolvedKey ));
11691169 }
11701170 $ export = $ this ->exportParameters ([$ value ]);
1171- $ export = explode ('0 => ' , substr (rtrim ($ export , " ) \n" ), 7 , -1 ), 2 );
1171+ $ export = explode ('0 => ' , substr (rtrim ($ export , " ] \n" ), 2 , -1 ), 2 );
11721172
11731173 if (preg_match ("/ \\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDirs\[\d++\])/ " , $ export [1 ])) {
11741174 $ dynamicPhp [$ key ] = sprintf ('%scase %s: $value = %s; break; ' , $ export [0 ], $ this ->export ($ key ), $ export [1 ]);
11751175 } else {
11761176 $ php [] = sprintf ('%s%s => %s, ' , $ export [0 ], $ this ->export ($ key ), $ export [1 ]);
11771177 }
11781178 }
1179- $ parameters = sprintf ("array( \n%s \n%s) " , implode ("\n" , $ php ), str_repeat (' ' , 8 ));
1179+
1180+ $ parameters = sprintf ("[ \n%s \n%s] " , implode ("\n" , $ php ), str_repeat (' ' , 8 ));
11801181
11811182 $ code = <<<'EOF'
11821183
@@ -1246,14 +1247,14 @@ public function getParameterBag()
12461247EOF;
12471248 $ getDynamicParameter = sprintf ($ getDynamicParameter , implode ("\n" , $ dynamicPhp ));
12481249 } else {
1249- $ loadedDynamicParameters = 'array() ' ;
1250+ $ loadedDynamicParameters = '[] ' ;
12501251 $ getDynamicParameter = str_repeat (' ' , 8 ).'throw new InvalidArgumentException(sprintf( \'The dynamic parameter "%s" must be defined. \', $name)); ' ;
12511252 }
12521253
12531254 $ code .= <<<EOF
12541255
12551256 private \$loadedDynamicParameters = {$ loadedDynamicParameters };
1256- private \$dynamicParameters = array() ;
1257+ private \$dynamicParameters = [] ;
12571258
12581259 /* {$ this ->docStar }
12591260 * Computes a dynamic parameter.
@@ -1310,7 +1311,7 @@ private function exportParameters(array $parameters, string $path = '', int $ind
13101311 $ php [] = sprintf ('%s%s => %s, ' , str_repeat (' ' , $ indent ), $ this ->export ($ key ), $ value );
13111312 }
13121313
1313- return sprintf ("array( \n%s \n%s) " , implode ("\n" , $ php ), str_repeat (' ' , $ indent - 4 ));
1314+ return sprintf ("[ \n%s \n%s] " , implode ("\n" , $ php ), str_repeat (' ' , $ indent - 4 ));
13141315 }
13151316
13161317 private function endClass (): string
@@ -1404,7 +1405,7 @@ private function dumpValue($value, bool $interpolate = true): string
14041405 $ code [] = sprintf ('%s => %s ' , $ this ->dumpValue ($ k , $ interpolate ), $ this ->dumpValue ($ v , $ interpolate ));
14051406 }
14061407
1407- return sprintf ('array(%s) ' , implode (', ' , $ code ));
1408+ return sprintf ('[%s] ' , implode (', ' , $ code ));
14081409 } elseif ($ value instanceof ArgumentInterface) {
14091410 $ scope = [$ this ->definitionVariables , $ this ->referenceVariables ];
14101411 $ this ->definitionVariables = $ this ->referenceVariables = null ;
0 commit comments