Skip to content

Commit 4d968e3

Browse files
committed
fixed CS
1 parent d678a5b commit 4d968e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+406
-406
lines changed

ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_
618618
* the parameters passed to the container constructor to have precedence
619619
* over the loaded ones.
620620
*
621-
* $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar')));
621+
* $container = new ContainerBuilder(new ParameterBag(['foo' => 'bar']));
622622
* $loader = new LoaderXXX($container);
623623
* $loader->load('resource_name');
624624
* $container->register('foo', 'stdClass');
@@ -1253,7 +1253,7 @@ private function doResolveServices($value, array &$inlineServices = [], $isConst
12531253
*
12541254
* Example:
12551255
*
1256-
* $container->register('foo')->addTag('my.tag', array('hello' => 'world'));
1256+
* $container->register('foo')->addTag('my.tag', ['hello' => 'world']);
12571257
*
12581258
* $serviceIds = $container->findTaggedServiceIds('my.tag');
12591259
* foreach ($serviceIds as $serviceId => $tags) {

Dumper/PhpDumper.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function dump(array $options = [])
224224
if ($this->addGetService) {
225225
$code = preg_replace(
226226
"/(\r?\n\r?\n public function __construct.+?\\{\r?\n)/s",
227-
"\n private \$getService;$1 \$this->getService = \\Closure::fromCallable(array(\$this, 'getService'));\n",
227+
"\n private \$getService;$1 \$this->getService = \\Closure::fromCallable([\$this, 'getService']);\n",
228228
$code,
229229
1
230230
);
@@ -250,11 +250,11 @@ public function dump(array $options = [])
250250
}
251251
if ($ids = array_keys($ids)) {
252252
sort($ids);
253-
$c = "<?php\n\nreturn array(\n";
253+
$c = "<?php\n\nreturn [\n";
254254
foreach ($ids as $id) {
255255
$c .= ' '.$this->doExport($id)." => true,\n";
256256
}
257-
$files['removed-ids.php'] = $c .= ");\n";
257+
$files['removed-ids.php'] = $c .= "];\n";
258258
}
259259

260260
foreach ($this->generateServiceFiles($services) as $file => $c) {
@@ -293,11 +293,11 @@ public function dump(array $options = [])
293293
\\class_alias(\\Container{$hash}\\{$options['class']}::class, {$options['class']}::class, false);
294294
}
295295
296-
return new \\Container{$hash}\\{$options['class']}(array(
296+
return new \\Container{$hash}\\{$options['class']}([
297297
'container.build_hash' => '$hash',
298298
'container.build_id' => '$id',
299299
'container.build_time' => $time,
300-
), __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}');
300+
], __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}');
301301
302302
EOF;
303303
} else {
@@ -952,7 +952,7 @@ private function startClass(string $class, string $baseClass, string $baseClassW
952952
class $class extends $baseClass
953953
{
954954
private \$parameters;
955-
private \$targetDirs = array();
955+
private \$targetDirs = [];
956956
957957
public function __construct()
958958
{
@@ -970,7 +970,7 @@ public function __construct()
970970
}
971971
if ($this->asFiles) {
972972
$code = str_replace('$parameters', "\$buildParameters;\n private \$containerDir;\n private \$parameters", $code);
973-
$code = str_replace('__construct()', '__construct(array $buildParameters = array(), $containerDir = __DIR__)', $code);
973+
$code = str_replace('__construct()', '__construct(array $buildParameters = [], $containerDir = __DIR__)', $code);
974974
$code .= " \$this->buildParameters = \$buildParameters;\n";
975975
$code .= " \$this->containerDir = \$containerDir;\n";
976976
}
@@ -990,7 +990,7 @@ public function __construct()
990990
if ($this->container->getParameterBag()->all()) {
991991
$code .= " \$this->parameters = \$this->getDefaultParameters();\n\n";
992992
}
993-
$code .= " \$this->services = \$this->privates = array();\n";
993+
$code .= " \$this->services = \$this->privates = [];\n";
994994

995995
$code .= $this->addSyntheticIds();
996996
$code .= $this->addMethodMap();
@@ -1064,7 +1064,7 @@ private function addSyntheticIds(): string
10641064
}
10651065
}
10661066

1067-
return $code ? " \$this->syntheticIds = array(\n{$code} );\n" : '';
1067+
return $code ? " \$this->syntheticIds = [\n{$code} ];\n" : '';
10681068
}
10691069

10701070
private function addRemovedIds(): string
@@ -1091,7 +1091,7 @@ private function addRemovedIds(): string
10911091
$code .= ' '.$this->doExport($id)." => true,\n";
10921092
}
10931093

1094-
$code = "array(\n{$code} )";
1094+
$code = "[\n{$code} ]";
10951095
}
10961096

10971097
return <<<EOF
@@ -1115,7 +1115,7 @@ private function addMethodMap(): string
11151115
}
11161116
}
11171117

1118-
return $code ? " \$this->methodMap = array(\n{$code} );\n" : '';
1118+
return $code ? " \$this->methodMap = [\n{$code} ];\n" : '';
11191119
}
11201120

11211121
private function addFileMap(): string
@@ -1129,16 +1129,16 @@ private function addFileMap(): string
11291129
}
11301130
}
11311131

1132-
return $code ? " \$this->fileMap = array(\n{$code} );\n" : '';
1132+
return $code ? " \$this->fileMap = [\n{$code} ];\n" : '';
11331133
}
11341134

11351135
private function addAliases(): string
11361136
{
11371137
if (!$aliases = $this->container->getAliases()) {
1138-
return "\n \$this->aliases = array();\n";
1138+
return "\n \$this->aliases = [];\n";
11391139
}
11401140

1141-
$code = " \$this->aliases = array(\n";
1141+
$code = " \$this->aliases = [\n";
11421142
ksort($aliases);
11431143
foreach ($aliases as $alias => $id) {
11441144
$id = (string) $id;
@@ -1148,7 +1148,7 @@ private function addAliases(): string
11481148
$code .= ' '.$this->doExport($alias).' => '.$this->doExport($id).",\n";
11491149
}
11501150

1151-
return $code." );\n";
1151+
return $code." ];\n";
11521152
}
11531153

11541154
private function addInlineRequires(): string
@@ -1196,15 +1196,15 @@ private function addDefaultParametersMethod(): string
11961196
throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: %s.', $resolvedKey));
11971197
}
11981198
$export = $this->exportParameters([$value]);
1199-
$export = explode('0 => ', substr(rtrim($export, " )\n"), 7, -1), 2);
1199+
$export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2);
12001200

12011201
if (preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDirs\[\d++\])/", $export[1])) {
12021202
$dynamicPhp[$key] = sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]);
12031203
} else {
12041204
$php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]);
12051205
}
12061206
}
1207-
$parameters = sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', 8));
1207+
$parameters = sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', 8));
12081208

12091209
$code = <<<'EOF'
12101210
@@ -1274,14 +1274,14 @@ public function getParameterBag()
12741274
EOF;
12751275
$getDynamicParameter = sprintf($getDynamicParameter, implode("\n", $dynamicPhp));
12761276
} else {
1277-
$loadedDynamicParameters = 'array()';
1277+
$loadedDynamicParameters = '[]';
12781278
$getDynamicParameter = str_repeat(' ', 8).'throw new InvalidArgumentException(sprintf(\'The dynamic parameter "%s" must be defined.\', $name));';
12791279
}
12801280

12811281
$code .= <<<EOF
12821282
12831283
private \$loadedDynamicParameters = {$loadedDynamicParameters};
1284-
private \$dynamicParameters = array();
1284+
private \$dynamicParameters = [];
12851285
12861286
/*{$this->docStar}
12871287
* Computes a dynamic parameter.
@@ -1338,7 +1338,7 @@ private function exportParameters(array $parameters, string $path = '', int $ind
13381338
$php[] = sprintf('%s%s => %s,', str_repeat(' ', $indent), $this->export($key), $value);
13391339
}
13401340

1341-
return sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', $indent - 4));
1341+
return sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', $indent - 4));
13421342
}
13431343

13441344
private function endClass(): string
@@ -1444,7 +1444,7 @@ private function dumpValue($value, bool $interpolate = true): string
14441444
$code[] = sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate));
14451445
}
14461446

1447-
return sprintf('array(%s)', implode(', ', $code));
1447+
return sprintf('[%s]', implode(', ', $code));
14481448
} elseif ($value instanceof ArgumentInterface) {
14491449
$scope = [$this->definitionVariables, $this->referenceVariables];
14501450
$this->definitionVariables = $this->referenceVariables = null;
@@ -1502,7 +1502,7 @@ private function dumpValue($value, bool $interpolate = true): string
15021502
}
15031503
$definition = $this->container->findDefinition($id = (string) $v);
15041504
$load = !($e = $definition->getErrors()) ? $this->asFiles && !$this->isHotPath($definition) : reset($e);
1505-
$serviceMap .= sprintf("\n %s => array(%s, %s, %s, %s),",
1505+
$serviceMap .= sprintf("\n %s => [%s, %s, %s, %s],",
15061506
$this->export($k),
15071507
$this->export($definition->isShared() ? ($definition->isPublic() ? 'services' : 'privates') : false),
15081508
$this->export($id),
@@ -1513,7 +1513,7 @@ private function dumpValue($value, bool $interpolate = true): string
15131513
}
15141514
$this->addGetService = true;
15151515

1516-
return sprintf('new \%s($this->getService, array(%s%s))', ServiceLocator::class, $serviceMap, $serviceMap ? "\n " : '');
1516+
return sprintf('new \%s($this->getService, [%s%s])', ServiceLocator::class, $serviceMap, $serviceMap ? "\n " : '');
15171517
}
15181518
} finally {
15191519
list($this->definitionVariables, $this->referenceVariables) = $scope;

Tests/Fixtures/config/prototype_array.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
->tag('baz');
1010
$di->load(Prototype::class.'\\', '../Prototype')
1111
->autoconfigure()
12-
->exclude(array('../Prototype/OtherDir', '../Prototype/BadClasses'))
12+
->exclude(['../Prototype/OtherDir', '../Prototype/BadClasses'])
1313
->factory('f')
1414
->deprecate('%service_id%')
15-
->args(array(0))
16-
->args(array(1))
15+
->args([0])
16+
->args([1])
1717
->autoconfigure(false)
1818
->tag('foo')
1919
->parent('foo');

Tests/Fixtures/containers/container_service_locator_argument.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333

3434
$container
3535
->register('bar', 'stdClass')
36-
->setProperty('locator', new ServiceLocatorArgument(array(
36+
->setProperty('locator', new ServiceLocatorArgument([
3737
'foo1' => new Reference('foo1'),
3838
'foo2' => new Reference('foo2'),
3939
'foo3' => new Reference('foo3'),
4040
'foo4' => new Reference('foo4', $container::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE),
4141
'foo5' => new Reference('foo5', $container::IGNORE_ON_UNINITIALIZED_REFERENCE),
42-
)))
42+
]))
4343
->setPublic(true)
4444
;
4545

Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithoutArgumentsContainer
2020
{
2121
private $parameters;
22-
private $targetDirs = array();
22+
private $targetDirs = [];
2323

2424
public function __construct()
2525
{
2626
parent::__construct();
2727
$this->parameterBag = null;
2828

29-
$this->services = $this->privates = array();
29+
$this->services = $this->privates = [];
3030

31-
$this->aliases = array();
31+
$this->aliases = [];
3232
}
3333

3434
public function compile()
@@ -43,9 +43,9 @@ public function isCompiled()
4343

4444
public function getRemovedIds()
4545
{
46-
return array(
46+
return [
4747
'Psr\\Container\\ContainerInterface' => true,
4848
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
49-
);
49+
];
5050
}
5151
}

Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithMandatoryArgumentsContainer
2020
{
2121
private $parameters;
22-
private $targetDirs = array();
22+
private $targetDirs = [];
2323

2424
public function __construct()
2525
{
26-
$this->services = $this->privates = array();
26+
$this->services = $this->privates = [];
2727

28-
$this->aliases = array();
28+
$this->aliases = [];
2929
}
3030

3131
public function compile()
@@ -40,9 +40,9 @@ public function isCompiled()
4040

4141
public function getRemovedIds()
4242
{
43-
return array(
43+
return [
4444
'Psr\\Container\\ContainerInterface' => true,
4545
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
46-
);
46+
];
4747
}
4848
}

Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithOptionalArgumentsContainer
2020
{
2121
private $parameters;
22-
private $targetDirs = array();
22+
private $targetDirs = [];
2323

2424
public function __construct()
2525
{
2626
parent::__construct();
2727
$this->parameterBag = null;
2828

29-
$this->services = $this->privates = array();
29+
$this->services = $this->privates = [];
3030

31-
$this->aliases = array();
31+
$this->aliases = [];
3232
}
3333

3434
public function compile()
@@ -43,9 +43,9 @@ public function isCompiled()
4343

4444
public function getRemovedIds()
4545
{
46-
return array(
46+
return [
4747
'Psr\\Container\\ContainerInterface' => true,
4848
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
49-
);
49+
];
5050
}
5151
}

Tests/Fixtures/php/custom_container_class_without_constructor.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\NoConstructorContainer
2020
{
2121
private $parameters;
22-
private $targetDirs = array();
22+
private $targetDirs = [];
2323

2424
public function __construct()
2525
{
26-
$this->services = $this->privates = array();
26+
$this->services = $this->privates = [];
2727

28-
$this->aliases = array();
28+
$this->aliases = [];
2929
}
3030

3131
public function compile()
@@ -40,9 +40,9 @@ public function isCompiled()
4040

4141
public function getRemovedIds()
4242
{
43-
return array(
43+
return [
4444
'Psr\\Container\\ContainerInterface' => true,
4545
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
46-
);
46+
];
4747
}
4848
}

Tests/Fixtures/php/services1-1.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
class Container extends \Symfony\Component\DependencyInjection\Dump\AbstractContainer
2020
{
2121
private $parameters;
22-
private $targetDirs = array();
22+
private $targetDirs = [];
2323

2424
public function __construct()
2525
{
26-
$this->services = $this->privates = array();
26+
$this->services = $this->privates = [];
2727

28-
$this->aliases = array();
28+
$this->aliases = [];
2929
}
3030

3131
public function compile()
@@ -40,9 +40,9 @@ public function isCompiled()
4040

4141
public function getRemovedIds()
4242
{
43-
return array(
43+
return [
4444
'Psr\\Container\\ContainerInterface' => true,
4545
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
46-
);
46+
];
4747
}
4848
}

0 commit comments

Comments
 (0)