@@ -223,11 +223,11 @@ public function dump(array $options = [])
223
223
}
224
224
if ($ ids = array_keys ($ ids )) {
225
225
sort ($ ids );
226
- $ c = "<?php \n\nreturn array( \n" ;
226
+ $ c = "<?php \n\nreturn [ \n" ;
227
227
foreach ($ ids as $ id ) {
228
228
$ c .= ' ' .$ this ->doExport ($ id )." => true, \n" ;
229
229
}
230
- $ files ['removed-ids.php ' ] = $ c .= ") ; \n" ;
230
+ $ files ['removed-ids.php ' ] = $ c .= "] ; \n" ;
231
231
}
232
232
233
233
foreach ($ this ->generateServiceFiles () as $ file => $ c ) {
@@ -266,11 +266,11 @@ public function dump(array $options = [])
266
266
\\class_alias(\\Container {$ hash }\\ {$ options ['class ' ]}::class, {$ options ['class ' ]}::class, false);
267
267
}
268
268
269
- return new \\Container {$ hash }\\ {$ options ['class ' ]}(array(
269
+ return new \\Container {$ hash }\\ {$ options ['class ' ]}([
270
270
'container.build_hash' => ' $ hash',
271
271
'container.build_id' => ' $ id',
272
272
'container.build_time' => $ time,
273
- ) , __DIR__.\\DIRECTORY_SEPARATOR.'Container {$ hash }');
273
+ ] , __DIR__.\\DIRECTORY_SEPARATOR.'Container {$ hash }');
274
274
275
275
EOF ;
276
276
} else {
@@ -913,12 +913,12 @@ private function startClass(string $class, string $baseClass, string $baseClassW
913
913
class $ class extends $ baseClass
914
914
{
915
915
private \$parameters;
916
- private \$targetDirs = array() ;
916
+ private \$targetDirs = [] ;
917
917
918
918
/* {$ this ->docStar }
919
919
* @internal but protected for BC on cache:clear
920
920
*/
921
- protected \$privates = array() ;
921
+ protected \$privates = [] ;
922
922
923
923
public function __construct()
924
924
{
@@ -936,7 +936,7 @@ public function __construct()
936
936
}
937
937
if ($ this ->asFiles ) {
938
938
$ 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 );
940
940
$ code .= " \$this->buildParameters = \$buildParameters; \n" ;
941
941
$ code .= " \$this->containerDir = \$containerDir; \n" ;
942
942
}
@@ -956,7 +956,7 @@ public function __construct()
956
956
if ($ this ->container ->getParameterBag ()->all ()) {
957
957
$ code .= " \$this->parameters = \$this->getDefaultParameters(); \n\n" ;
958
958
}
959
- $ code .= " \$this->services = \$this->privates = array() ; \n" ;
959
+ $ code .= " \$this->services = \$this->privates = [] ; \n" ;
960
960
961
961
$ code .= $ this ->addSyntheticIds ();
962
962
$ code .= $ this ->addMethodMap ();
@@ -968,7 +968,7 @@ public function __construct()
968
968
969
969
public function reset()
970
970
{
971
- \$this->privates = array() ;
971
+ \$this->privates = [] ;
972
972
parent::reset();
973
973
}
974
974
@@ -1036,7 +1036,7 @@ private function addSyntheticIds(): string
1036
1036
}
1037
1037
}
1038
1038
1039
- return $ code ? " \$this->syntheticIds = array( \n{$ code } ) ; \n" : '' ;
1039
+ return $ code ? " \$this->syntheticIds = [ \n{$ code } ] ; \n" : '' ;
1040
1040
}
1041
1041
1042
1042
private function addRemovedIds (): string
@@ -1063,7 +1063,7 @@ private function addRemovedIds(): string
1063
1063
$ code .= ' ' .$ this ->doExport ($ id )." => true, \n" ;
1064
1064
}
1065
1065
1066
- $ code = "array( \n{$ code } ) " ;
1066
+ $ code = "[ \n{$ code } ] " ;
1067
1067
}
1068
1068
1069
1069
return <<<EOF
@@ -1087,7 +1087,7 @@ private function addMethodMap(): string
1087
1087
}
1088
1088
}
1089
1089
1090
- return $ code ? " \$this->methodMap = array( \n{$ code } ) ; \n" : '' ;
1090
+ return $ code ? " \$this->methodMap = [ \n{$ code } ] ; \n" : '' ;
1091
1091
}
1092
1092
1093
1093
private function addFileMap (): string
@@ -1101,16 +1101,16 @@ private function addFileMap(): string
1101
1101
}
1102
1102
}
1103
1103
1104
- return $ code ? " \$this->fileMap = array( \n{$ code } ) ; \n" : '' ;
1104
+ return $ code ? " \$this->fileMap = [ \n{$ code } ] ; \n" : '' ;
1105
1105
}
1106
1106
1107
1107
private function addAliases (): string
1108
1108
{
1109
1109
if (!$ aliases = $ this ->container ->getAliases ()) {
1110
- return "\n \$this->aliases = array() ; \n" ;
1110
+ return "\n \$this->aliases = [] ; \n" ;
1111
1111
}
1112
1112
1113
- $ code = " \$this->aliases = array( \n" ;
1113
+ $ code = " \$this->aliases = [ \n" ;
1114
1114
ksort ($ aliases );
1115
1115
foreach ($ aliases as $ alias => $ id ) {
1116
1116
$ id = (string ) $ id ;
@@ -1120,7 +1120,7 @@ private function addAliases(): string
1120
1120
$ code .= ' ' .$ this ->doExport ($ alias ).' => ' .$ this ->doExport ($ id ).", \n" ;
1121
1121
}
1122
1122
1123
- return $ code ." ) ; \n" ;
1123
+ return $ code ." ] ; \n" ;
1124
1124
}
1125
1125
1126
1126
private function addInlineRequires (): string
@@ -1168,15 +1168,16 @@ private function addDefaultParametersMethod(): string
1168
1168
throw new InvalidArgumentException (sprintf ('Parameter name cannot use env parameters: %s. ' , $ resolvedKey ));
1169
1169
}
1170
1170
$ 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 );
1172
1172
1173
1173
if (preg_match ("/ \\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDirs\[\d++\])/ " , $ export [1 ])) {
1174
1174
$ dynamicPhp [$ key ] = sprintf ('%scase %s: $value = %s; break; ' , $ export [0 ], $ this ->export ($ key ), $ export [1 ]);
1175
1175
} else {
1176
1176
$ php [] = sprintf ('%s%s => %s, ' , $ export [0 ], $ this ->export ($ key ), $ export [1 ]);
1177
1177
}
1178
1178
}
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 ));
1180
1181
1181
1182
$ code = <<<'EOF'
1182
1183
@@ -1246,14 +1247,14 @@ public function getParameterBag()
1246
1247
EOF;
1247
1248
$ getDynamicParameter = sprintf ($ getDynamicParameter , implode ("\n" , $ dynamicPhp ));
1248
1249
} else {
1249
- $ loadedDynamicParameters = 'array() ' ;
1250
+ $ loadedDynamicParameters = '[] ' ;
1250
1251
$ getDynamicParameter = str_repeat (' ' , 8 ).'throw new InvalidArgumentException(sprintf( \'The dynamic parameter "%s" must be defined. \', $name)); ' ;
1251
1252
}
1252
1253
1253
1254
$ code .= <<<EOF
1254
1255
1255
1256
private \$loadedDynamicParameters = {$ loadedDynamicParameters };
1256
- private \$dynamicParameters = array() ;
1257
+ private \$dynamicParameters = [] ;
1257
1258
1258
1259
/* {$ this ->docStar }
1259
1260
* Computes a dynamic parameter.
@@ -1310,7 +1311,7 @@ private function exportParameters(array $parameters, string $path = '', int $ind
1310
1311
$ php [] = sprintf ('%s%s => %s, ' , str_repeat (' ' , $ indent ), $ this ->export ($ key ), $ value );
1311
1312
}
1312
1313
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 ));
1314
1315
}
1315
1316
1316
1317
private function endClass (): string
@@ -1404,7 +1405,7 @@ private function dumpValue($value, bool $interpolate = true): string
1404
1405
$ code [] = sprintf ('%s => %s ' , $ this ->dumpValue ($ k , $ interpolate ), $ this ->dumpValue ($ v , $ interpolate ));
1405
1406
}
1406
1407
1407
- return sprintf ('array(%s) ' , implode (', ' , $ code ));
1408
+ return sprintf ('[%s] ' , implode (', ' , $ code ));
1408
1409
} elseif ($ value instanceof ArgumentInterface) {
1409
1410
$ scope = [$ this ->definitionVariables , $ this ->referenceVariables ];
1410
1411
$ this ->definitionVariables = $ this ->referenceVariables = null ;
0 commit comments