diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 1e348b2bf4..dc14f967f9 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -215,11 +215,11 @@ EOF; if ($ids = array_keys($this->container->getRemovedIds())) { sort($ids); - $c = "doExport($id)." => true,\n"; } - $files['removed-ids.php'] = $c .= ");\n"; + $files['removed-ids.php'] = $c .= "];\n"; } foreach ($this->generateServiceFiles() as $file => $c) { @@ -258,11 +258,11 @@ if (!\\class_exists({$options['class']}::class, false)) { \\class_alias(\\Container{$hash}\\{$options['class']}::class, {$options['class']}::class, false); } -return new \\Container{$hash}\\{$options['class']}(array( +return new \\Container{$hash}\\{$options['class']}([ 'container.build_hash' => '$hash', 'container.build_id' => '$id', 'container.build_time' => $time, -), __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}'); +], __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}'); EOF; } else { @@ -607,7 +607,7 @@ EOF; return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } - return sprintf(" \\call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); + return sprintf(" \\call_user_func([%s, '%s'], \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } return sprintf(" %s(\$%s);\n", $callable, $variableName); @@ -900,7 +900,7 @@ EOTXT return $return.sprintf("(%s)->%s(%s);\n", $class, $callable[1], $arguments ? implode(', ', $arguments) : ''); } - return $return.sprintf("\\call_user_func(array(%s, '%s')%s);\n", $class, $callable[1], $arguments ? ', '.implode(', ', $arguments) : ''); + return $return.sprintf("\\call_user_func([%s, '%s']%s);\n", $class, $callable[1], $arguments ? ', '.implode(', ', $arguments) : ''); } return $return.sprintf("%s(%s);\n", $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? implode(', ', $arguments) : ''); @@ -947,7 +947,7 @@ $bagClass class $class extends $baseClass { private \$parameters; - private \$targetDirs = array(); + private \$targetDirs = []; public function __construct() { @@ -965,7 +965,7 @@ EOF; } if ($this->asFiles) { $code = str_replace('$parameters', "\$buildParameters;\n private \$containerDir;\n private \$parameters", $code); - $code = str_replace('__construct()', '__construct(array $buildParameters = array(), $containerDir = __DIR__)', $code); + $code = str_replace('__construct()', '__construct(array $buildParameters = [], $containerDir = __DIR__)', $code); $code .= " \$this->buildParameters = \$buildParameters;\n"; $code .= " \$this->containerDir = \$containerDir;\n"; } @@ -987,7 +987,7 @@ EOF; $code .= " \$this->parameters = \$this->getDefaultParameters();\n\n"; } - $code .= " \$this->services = array();\n"; + $code .= " \$this->services = [];\n"; } else { $arguments = $this->container->getParameterBag()->all() ? 'new ParameterBag($this->getDefaultParameters())' : null; $code .= " parent::__construct($arguments);\n"; @@ -1085,7 +1085,7 @@ EOF; } } - return $code ? " \$this->normalizedIds = array(\n".$code." );\n" : ''; + return $code ? " \$this->normalizedIds = [\n".$code." ];\n" : ''; } /** @@ -1104,7 +1104,7 @@ EOF; } } - return $code ? " \$this->syntheticIds = array(\n{$code} );\n" : ''; + return $code ? " \$this->syntheticIds = [\n{$code} ];\n" : ''; } /** @@ -1130,7 +1130,7 @@ EOF; $code .= ' '.$this->doExport($id)." => true,\n"; } - $code = "array(\n{$code} )"; + $code = "[\n{$code} ]"; } return <<methodMap = array(\n{$code} );\n" : ''; + return $code ? " \$this->methodMap = [\n{$code} ];\n" : ''; } /** @@ -1178,7 +1178,7 @@ EOF; } } - return $code ? " \$this->fileMap = array(\n{$code} );\n" : ''; + return $code ? " \$this->fileMap = [\n{$code} ];\n" : ''; } /** @@ -1210,9 +1210,9 @@ EOF; return ''; } - $out = " \$this->privates = array(\n"; + $out = " \$this->privates = [\n"; $out .= $code; - $out .= " );\n"; + $out .= " ];\n"; return $out; } @@ -1225,10 +1225,10 @@ EOF; private function addAliases() { if (!$aliases = $this->container->getAliases()) { - return $this->container->isCompiled() ? "\n \$this->aliases = array();\n" : ''; + return $this->container->isCompiled() ? "\n \$this->aliases = [];\n" : ''; } - $code = " \$this->aliases = array(\n"; + $code = " \$this->aliases = [\n"; ksort($aliases); foreach ($aliases as $alias => $id) { $id = $this->container->normalizeId($id); @@ -1238,7 +1238,7 @@ EOF; $code .= ' '.$this->doExport($alias).' => '.$this->doExport($id).",\n"; } - return $code." );\n"; + return $code." ];\n"; } private function addInlineRequires() @@ -1295,7 +1295,7 @@ EOF; $normalizedParams[] = sprintf(' %s => %s,', $this->export($lcKey), $this->export($key)); } $export = $this->exportParameters([$value]); - $export = explode('0 => ', substr(rtrim($export, " )\n"), 7, -1), 2); + $export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2); if (preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDirs\[\d++\])/", $export[1])) { $dynamicPhp[$key] = sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]); @@ -1303,7 +1303,8 @@ EOF; $php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]); } } - $parameters = sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', 8)); + + $parameters = sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', 8)); $code = ''; if ($this->container->isCompiled()) { @@ -1379,14 +1380,14 @@ EOF; EOF; $getDynamicParameter = sprintf($getDynamicParameter, implode("\n", $dynamicPhp)); } else { - $loadedDynamicParameters = 'array()'; + $loadedDynamicParameters = '[]'; $getDynamicParameter = str_repeat(' ', 8).'throw new InvalidArgumentException(sprintf(\'The dynamic parameter "%s" must be defined.\', $name));'; } $code .= <<docStar} * Computes a dynamic parameter. @@ -1405,7 +1406,7 @@ EOF; EOF; - $code .= ' private $normalizedParameterNames = '.($normalizedParams ? sprintf("array(\n%s\n );", implode("\n", $normalizedParams)) : 'array();')."\n"; + $code .= ' private $normalizedParameterNames = '.($normalizedParams ? sprintf("[\n%s\n ];", implode("\n", $normalizedParams)) : '[];')."\n"; $code .= <<<'EOF' private function normalizeParameterName($name) @@ -1478,7 +1479,7 @@ EOF; $php[] = sprintf('%s%s => %s,', str_repeat(' ', $indent), $this->export($key), $value); } - return sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', $indent - 4)); + return sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', $indent - 4)); } /** @@ -1599,7 +1600,7 @@ EOF; $code[] = sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate)); } - return sprintf('array(%s)', implode(', ', $code)); + return sprintf('[%s]', implode(', ', $code)); } elseif ($value instanceof ArgumentInterface) { $scope = [$this->definitionVariables, $this->referenceVariables]; $this->definitionVariables = $this->referenceVariables = null; @@ -1691,7 +1692,7 @@ EOF; return sprintf('(%s)->%s(%s)', $class, $factory[1], implode(', ', $arguments)); } - return sprintf("\\call_user_func(array(%s, '%s')%s)", $class, $factory[1], \count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); + return sprintf("\\call_user_func([%s, '%s']%s)", $class, $factory[1], \count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); } if ($factory[0] instanceof Reference) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Bar.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Bar.php index d243866d36..83f2da12a7 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Bar.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Bar.php @@ -13,7 +13,7 @@ namespace Symfony\Component\DependencyInjection\Tests\Fixtures; class Bar implements BarInterface { - public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = array()) + public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = []) { } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriber.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriber.php index 875abe9e02..a3b042b8f2 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriber.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriber.php @@ -12,11 +12,11 @@ class TestServiceSubscriber implements ServiceSubscriberInterface public static function getSubscribedServices() { - return array( + return [ __CLASS__, '?'.CustomDefinition::class, 'bar' => CustomDefinition::class, 'baz' => '?'.CustomDefinition::class, - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/basic.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/basic.php index b98e894c37..a9e250b921 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/basic.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/basic.php @@ -7,5 +7,5 @@ use App\BarService; return function (ContainerConfigurator $c) { $s = $c->services(); $s->set(BarService::class) - ->args(array(inline('FooClass'))); + ->args([inline('FooClass')]); }; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/child.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/child.php index 6fd84485e7..8a5f2431d0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/child.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/child.php @@ -13,7 +13,7 @@ return function (ContainerConfigurator $c) { ->set('foo') ->parent(BarService::class) ->decorate('bar', 'b', 1) - ->args(array(ref('b'))) + ->args([ref('b')]) ->class('Class2') ->file('file.php') ->parent('bar') diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/defaults.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/defaults.php index de3b99d745..2889d3fbb6 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/defaults.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/defaults.php @@ -12,10 +12,10 @@ return function (ContainerConfigurator $c) { ->private() ->autoconfigure() ->autowire() - ->tag('t', array('a' => 'b')) + ->tag('t', ['a' => 'b']) ->bind(Foo::class, ref('bar')) ->private(); - $s->set(Foo::class)->args(array(ref('bar')))->public(); + $s->set(Foo::class)->args([ref('bar')])->public(); $s->set('bar', Foo::class)->call('setFoo')->autoconfigure(false); }; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/instanceof.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/instanceof.php index 062e8c00ab..0d6aac7a00 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/instanceof.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/instanceof.php @@ -9,8 +9,8 @@ return function (ContainerConfigurator $c) { $s = $c->services(); $s->instanceof(Prototype\Foo::class) ->property('p', 0) - ->call('setFoo', array(ref('foo'))) - ->tag('tag', array('k' => 'v')) + ->call('setFoo', [ref('foo')]) + ->tag('tag', ['k' => 'v']) ->share(false) ->lazy() ->configurator('c') diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/prototype.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/prototype.php index 622c51af57..e2884aa202 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/prototype.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/prototype.php @@ -12,8 +12,8 @@ return function (ContainerConfigurator $c) { ->exclude('../Prototype/{OtherDir,BadClasses}') ->factory('f') ->deprecate('%service_id%') - ->args(array(0)) - ->args(array(1)) + ->args([0]) + ->args([1]) ->autoconfigure(false) ->tag('foo') ->parent('foo'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php index b013e5126d..d9373a2a6f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php @@ -16,65 +16,65 @@ return function (ContainerConfigurator $c) { $s = $c->services(); $s->set('foo') - ->args(array('foo', ref('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, ref('service_container'))) + ->args(['foo', ref('foo.baz'), ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'], true, ref('service_container')]) ->class(FooClass::class) - ->tag('foo', array('foo' => 'foo')) - ->tag('foo', array('bar' => 'bar', 'baz' => 'baz')) - ->factory(array(FooClass::class, 'getInstance')) + ->tag('foo', ['foo' => 'foo']) + ->tag('foo', ['bar' => 'bar', 'baz' => 'baz']) + ->factory([FooClass::class, 'getInstance']) ->property('foo', 'bar') ->property('moo', ref('foo.baz')) - ->property('qux', array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%')) - ->call('setBar', array(ref('bar'))) + ->property('qux', ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%']) + ->call('setBar', [ref('bar')]) ->call('initialize') ->configurator('sc_configure'); $s->set('foo.baz', '%baz_class%') - ->factory(array('%baz_class%', 'getInstance')) - ->configurator(array('%baz_class%', 'configureStatic1')); + ->factory(['%baz_class%', 'getInstance']) + ->configurator(['%baz_class%', 'configureStatic1']); $s->set('bar', FooClass::class) - ->args(array('foo', ref('foo.baz'), new Parameter('foo_bar'))) - ->configurator(array(ref('foo.baz'), 'configure')); + ->args(['foo', ref('foo.baz'), new Parameter('foo_bar')]) + ->configurator([ref('foo.baz'), 'configure']); $s->set('foo_bar', '%foo_class%') - ->args(array(ref('deprecated_service'))) + ->args([ref('deprecated_service')]) ->share(false); $s->set('method_call1', 'Bar\FooClass') ->file(realpath(__DIR__.'/../includes/foo.php')) - ->call('setBar', array(ref('foo'))) - ->call('setBar', array(ref('foo2')->nullOnInvalid())) - ->call('setBar', array(ref('foo3')->ignoreOnInvalid())) - ->call('setBar', array(ref('foobaz')->ignoreOnInvalid())) - ->call('setBar', array(expr('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'))); + ->call('setBar', [ref('foo')]) + ->call('setBar', [ref('foo2')->nullOnInvalid()]) + ->call('setBar', [ref('foo3')->ignoreOnInvalid()]) + ->call('setBar', [ref('foobaz')->ignoreOnInvalid()]) + ->call('setBar', [expr('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]); $s->set('foo_with_inline', 'Foo') - ->call('setBar', array(ref('inlined'))); + ->call('setBar', [ref('inlined')]); $s->set('inlined', 'Bar') ->property('pub', 'pub') - ->call('setBaz', array(ref('baz'))) + ->call('setBaz', [ref('baz')]) ->private(); $s->set('baz', 'Baz') - ->call('setFoo', array(ref('foo_with_inline'))); + ->call('setFoo', [ref('foo_with_inline')]); $s->set('request', 'Request') ->synthetic(); $s->set('configurator_service', 'ConfClass') ->private() - ->call('setFoo', array(ref('baz'))); + ->call('setFoo', [ref('baz')]); $s->set('configured_service', 'stdClass') - ->configurator(array(ref('configurator_service'), 'configureStdClass')); + ->configurator([ref('configurator_service'), 'configureStdClass']); $s->set('configurator_service_simple', 'ConfClass') - ->args(array('bar')) + ->args(['bar']) ->private(); $s->set('configured_service_simple', 'stdClass') - ->configurator(array(ref('configurator_service_simple'), 'configureStdClass')); + ->configurator([ref('configurator_service_simple'), 'configureStdClass']); $s->set('decorated', 'stdClass'); @@ -92,28 +92,28 @@ return function (ContainerConfigurator $c) { ->private(); $s->set('factory_service', 'Bar') - ->factory(array(ref('foo.baz'), 'getInstance')); + ->factory([ref('foo.baz'), 'getInstance']); $s->set('new_factory_service', 'FooBarBaz') ->property('foo', 'bar') - ->factory(array(ref('new_factory'), 'getInstance')); + ->factory([ref('new_factory'), 'getInstance']); $s->set('service_from_static_method', 'Bar\FooClass') - ->factory(array('Bar\FooClass', 'getInstance')); + ->factory(['Bar\FooClass', 'getInstance']); $s->set('factory_simple', 'SimpleFactoryClass') ->deprecate() - ->args(array('foo')) + ->args(['foo']) ->private(); $s->set('factory_service_simple', 'Bar') - ->factory(array(ref('factory_simple'), 'getInstance')); + ->factory([ref('factory_simple'), 'getInstance']); $s->set('lazy_context', 'LazyContext') - ->args(array(iterator(array('k1' => ref('foo.baz'), 'k2' => ref('service_container'))), iterator(array()))); + ->args([iterator(['k1' => ref('foo.baz'), 'k2' => ref('service_container')]), iterator([])]); $s->set('lazy_context_ignore_invalid_ref', 'LazyContext') - ->args(array(iterator(array(ref('foo.baz'), ref('invalid')->ignoreOnInvalid())), iterator(array()))); + ->args([iterator([ref('foo.baz'), ref('invalid')->ignoreOnInvalid()]), iterator([])]); $s->set('tagged_iterator_foo', 'Bar') ->private() @@ -121,7 +121,7 @@ return function (ContainerConfigurator $c) { $s->set('tagged_iterator', 'Bar') ->public() - ->args(array(tagged('foo'))); + ->args([tagged('foo')]); $s->alias('alias_for_foo', 'foo')->private()->public(); $s->alias('alias_for_alias', ref('alias_for_foo')); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php index 150cd7921e..91e5c26330 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php @@ -6,7 +6,7 @@ use Symfony\Component\DependencyInjection\Definition; $container = new ContainerBuilder(); $container-> register('foo', 'FooClass')-> - addArgument(new Definition('BarClass', array(new Definition('BazClass')))) + addArgument(new Definition('BarClass', [new Definition('BazClass')])) ->setPublic(true) ; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php index bc527eb79e..ef07703024 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php @@ -6,7 +6,7 @@ $container = new ContainerBuilder(); $container-> register('foo', 'FooClass\\Foo')-> addArgument('foo<>&bar')-> - addTag('foo"bar\\bar', array('foo' => 'foo"barřž€')) + addTag('foo"bar\\bar', ['foo' => 'foo"barřž€']) ->setPublic(true) ; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container19.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container19.php index 300a5cc769..c3af5c9606 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container19.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container19.php @@ -12,7 +12,7 @@ $container->setParameter('foo', '%env(FOO)%'); $container ->register('service_from_anonymous_factory', '%foo%') - ->setFactory(array(new Definition('%foo%'), 'getInstance')) + ->setFactory([new Definition('%foo%'), 'getInstance']) ->setPublic(true) ; @@ -20,7 +20,7 @@ $anonymousServiceWithFactory = new Definition('Bar\FooClass'); $anonymousServiceWithFactory->setFactory('Bar\FooClass::getInstance'); $container ->register('service_with_method_call_and_factory', 'Bar\FooClass') - ->addMethodCall('setBar', array($anonymousServiceWithFactory)) + ->addMethodCall('setBar', [$anonymousServiceWithFactory]) ->setPublic(true) ; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container21.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container21.php index 298c9266a9..d82cf38538 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container21.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container21.php @@ -6,15 +6,15 @@ use Symfony\Component\DependencyInjection\Definition; $container = new ContainerBuilder(); $bar = new Definition('Bar'); -$bar->setConfigurator(array(new Definition('Baz'), 'configureBar')); +$bar->setConfigurator([new Definition('Baz'), 'configureBar']); $fooFactory = new Definition('FooFactory'); -$fooFactory->setFactory(array(new Definition('Foobar'), 'createFooFactory')); +$fooFactory->setFactory([new Definition('Foobar'), 'createFooFactory']); $container ->register('foo', 'Foo') - ->setFactory(array($fooFactory, 'createFoo')) - ->setConfigurator(array($bar, 'configureFoo')) + ->setFactory([$fooFactory, 'createFoo']) + ->setConfigurator([$bar, 'configureFoo']) ->setPublic(true) ; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php index 1a4e5ab5c8..5b3c01c23c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php @@ -3,12 +3,12 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -$container = new ContainerBuilder(new ParameterBag(array( +$container = new ContainerBuilder(new ParameterBag([ 'foo' => '%baz%', 'baz' => 'bar', 'bar' => 'foo is %%foo bar', 'escape' => '@escapeme', - 'values' => array(true, false, null, 0, 1000.3, 'true', 'false', 'null'), -))); + 'values' => [true, false, null, 0, 1000.3, 'true', 'false', 'null'], +])); return $container; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php index 21d35611c3..691a7fa695 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php @@ -14,26 +14,26 @@ use Symfony\Component\ExpressionLanguage\Expression; $container = new ContainerBuilder(); $container ->register('foo', '\Bar\FooClass') - ->addTag('foo', array('foo' => 'foo')) - ->addTag('foo', array('bar' => 'bar', 'baz' => 'baz')) - ->setFactory(array('Bar\\FooClass', 'getInstance')) - ->setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, new Reference('service_container'))) - ->setProperties(array('foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'))) - ->addMethodCall('setBar', array(new Reference('bar'))) + ->addTag('foo', ['foo' => 'foo']) + ->addTag('foo', ['bar' => 'bar', 'baz' => 'baz']) + ->setFactory(['Bar\\FooClass', 'getInstance']) + ->setArguments(['foo', new Reference('foo.baz'), ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'], true, new Reference('service_container')]) + ->setProperties(['foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%']]) + ->addMethodCall('setBar', [new Reference('bar')]) ->addMethodCall('initialize') ->setConfigurator('sc_configure') ->setPublic(true) ; $container ->register('foo.baz', '%baz_class%') - ->setFactory(array('%baz_class%', 'getInstance')) - ->setConfigurator(array('%baz_class%', 'configureStatic1')) + ->setFactory(['%baz_class%', 'getInstance']) + ->setConfigurator(['%baz_class%', 'configureStatic1']) ->setPublic(true) ; $container ->register('bar', 'Bar\FooClass') - ->setArguments(array('foo', new Reference('foo.baz'), new Parameter('foo_bar'))) - ->setConfigurator(array(new Reference('foo.baz'), 'configure')) + ->setArguments(['foo', new Reference('foo.baz'), new Parameter('foo_bar')]) + ->setConfigurator([new Reference('foo.baz'), 'configure']) ->setPublic(true) ; $container @@ -43,35 +43,35 @@ $container ->setPublic(true) ; $container->getParameterBag()->clear(); -$container->getParameterBag()->add(array( +$container->getParameterBag()->add([ 'baz_class' => 'BazClass', 'foo_class' => 'Bar\FooClass', 'foo' => 'bar', -)); +]); $container ->register('method_call1', 'Bar\FooClass') ->setFile(realpath(__DIR__.'/../includes/foo.php')) - ->addMethodCall('setBar', array(new Reference('foo'))) - ->addMethodCall('setBar', array(new Reference('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE))) - ->addMethodCall('setBar', array(new Reference('foo3', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))) - ->addMethodCall('setBar', array(new Reference('foobaz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))) - ->addMethodCall('setBar', array(new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'))) + ->addMethodCall('setBar', [new Reference('foo')]) + ->addMethodCall('setBar', [new Reference('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE)]) + ->addMethodCall('setBar', [new Reference('foo3', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]) + ->addMethodCall('setBar', [new Reference('foobaz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]) + ->addMethodCall('setBar', [new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]) ->setPublic(true) ; $container ->register('foo_with_inline', 'Foo') - ->addMethodCall('setBar', array(new Reference('inlined'))) + ->addMethodCall('setBar', [new Reference('inlined')]) ->setPublic(true) ; $container ->register('inlined', 'Bar') ->setProperty('pub', 'pub') - ->addMethodCall('setBaz', array(new Reference('baz'))) + ->addMethodCall('setBaz', [new Reference('baz')]) ->setPublic(false) ; $container ->register('baz', 'Baz') - ->addMethodCall('setFoo', array(new Reference('foo_with_inline'))) + ->addMethodCall('setFoo', [new Reference('foo_with_inline')]) ->setPublic(true) ; $container @@ -82,11 +82,11 @@ $container $container ->register('configurator_service', 'ConfClass') ->setPublic(false) - ->addMethodCall('setFoo', array(new Reference('baz'))) + ->addMethodCall('setFoo', [new Reference('baz')]) ; $container ->register('configured_service', 'stdClass') - ->setConfigurator(array(new Reference('configurator_service'), 'configureStdClass')) + ->setConfigurator([new Reference('configurator_service'), 'configureStdClass']) ->setPublic(true) ; $container @@ -96,7 +96,7 @@ $container ; $container ->register('configured_service_simple', 'stdClass') - ->setConfigurator(array(new Reference('configurator_service_simple'), 'configureStdClass')) + ->setConfigurator([new Reference('configurator_service_simple'), 'configureStdClass']) ->setPublic(true) ; $container @@ -125,18 +125,18 @@ $container ; $container ->register('factory_service', 'Bar') - ->setFactory(array(new Reference('foo.baz'), 'getInstance')) + ->setFactory([new Reference('foo.baz'), 'getInstance']) ->setPublic(true) ; $container ->register('new_factory_service', 'FooBarBaz') ->setProperty('foo', 'bar') - ->setFactory(array(new Reference('new_factory'), 'getInstance')) + ->setFactory([new Reference('new_factory'), 'getInstance']) ->setPublic(true) ; $container ->register('service_from_static_method', 'Bar\FooClass') - ->setFactory(array('Bar\FooClass', 'getInstance')) + ->setFactory(['Bar\FooClass', 'getInstance']) ->setPublic(true) ; $container @@ -147,17 +147,17 @@ $container ; $container ->register('factory_service_simple', 'Bar') - ->setFactory(array(new Reference('factory_simple'), 'getInstance')) + ->setFactory([new Reference('factory_simple'), 'getInstance']) ->setPublic(true) ; $container ->register('lazy_context', 'LazyContext') - ->setArguments(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array()))) + ->setArguments([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])]) ->setPublic(true) ; $container ->register('lazy_context_ignore_invalid_ref', 'LazyContext') - ->setArguments(array(new IteratorArgument(array(new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))), new IteratorArgument(array()))) + ->setArguments([new IteratorArgument([new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]), new IteratorArgument([])]) ->setPublic(true) ; $container diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_almost_circular.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_almost_circular.php index 4c9906f7ae..df136cfa5d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_almost_circular.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_almost_circular.php @@ -15,7 +15,7 @@ $container->register('foo', FooCircular::class)->setPublic(true) ->addArgument(new Reference('bar')); $container->register('bar', BarCircular::class)->setPublic($public) - ->addMethodCall('addFoobar', array(new Reference('foobar'))); + ->addMethodCall('addFoobar', [new Reference('foobar')]); $container->register('foobar', FoobarCircular::class)->setPublic($public) ->addArgument(new Reference('foo')); @@ -26,7 +26,7 @@ $container->register('foo2', FooCircular::class)->setPublic(true) ->addArgument(new Reference('bar2')); $container->register('bar2', BarCircular::class)->setPublic(!$public) - ->addMethodCall('addFoobar', array(new Reference('foobar2'))); + ->addMethodCall('addFoobar', [new Reference('foobar2')]); $container->register('foobar2', FoobarCircular::class)->setPublic($public) ->addArgument(new Reference('foo2')); @@ -34,7 +34,7 @@ $container->register('foobar2', FoobarCircular::class)->setPublic($public) // simple inline setter with internal reference $container->register('bar3', BarCircular::class)->setPublic(true) - ->addMethodCall('addFoobar', array(new Reference('foobar3'), new Reference('foobar3'))); + ->addMethodCall('addFoobar', [new Reference('foobar3'), new Reference('foobar3')]); $container->register('foobar3', FoobarCircular::class)->setPublic($public); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_env_in_id.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_env_in_id.php index 4699f41011..1e851cf016 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_env_in_id.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_env_in_id.php @@ -11,7 +11,7 @@ $container->setParameter('env(BAR)', 'bar'); $container->register('foo', 'stdClass')->setPublic(true) ->addArgument(new Reference('bar_%env(BAR)%')) - ->addArgument(array('baz_%env(BAR)%' => new Reference('baz_%env(BAR)%'))); + ->addArgument(['baz_%env(BAR)%' => new Reference('baz_%env(BAR)%')]); $container->register('bar', 'stdClass')->setPublic(true) ->addArgument(new Reference('bar_%env(BAR)%')); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_uninitialized_ref.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_uninitialized_ref.php index 7aeefb4d52..36c05c3fa3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_uninitialized_ref.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_uninitialized_ref.php @@ -33,16 +33,16 @@ $container ->setProperty('foo1', new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)) ->setProperty('foo2', new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)) ->setProperty('foo3', new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)) - ->setProperty('closures', array( + ->setProperty('closures', [ new ServiceClosureArgument(new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), new ServiceClosureArgument(new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), new ServiceClosureArgument(new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), - )) - ->setProperty('iter', new IteratorArgument(array( + ]) + ->setProperty('iter', new IteratorArgument([ 'foo1' => new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), 'foo2' => new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), 'foo3' => new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), - ))) + ])) ->setPublic(true) ; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php index ba07d7c44c..2198b19c4d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php @@ -14,7 +14,7 @@ class ProjectExtension implements ExtensionInterface if ($configs) { $config = call_user_func_array('array_merge', $configs); } else { - $config = array(); + $config = []; } $configuration->setDefinition('project.service.bar', new Definition('FooClass')); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php index bcb4e20a94..20bc928b97 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php @@ -11,14 +11,14 @@ class FooClass public $initialized = false; public $configured = false; public $called = false; - public $arguments = array(); + public $arguments = []; - public function __construct($arguments = array()) + public function __construct($arguments = []) { $this->arguments = $arguments; } - public static function getInstance($arguments = array()) + public static function getInstance($arguments = []) { $obj = new self($arguments); $obj->called = true; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php index 0a443f3a79..7495110dd8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php @@ -19,24 +19,24 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithoutArgumentsContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { parent::__construct(); $this->parameterBag = null; - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php index dd9ed9cbb3..eb573f9bae 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php @@ -19,21 +19,21 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithMandatoryArgumentsContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php index 6bf3c90613..d322f80a0f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php @@ -19,24 +19,24 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithOptionalArgumentsContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { parent::__construct(); $this->parameterBag = null; - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_without_constructor.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_without_constructor.php index 4cf1ae40b4..68bc1ef8be 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_without_constructor.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/custom_container_class_without_constructor.php @@ -19,21 +19,21 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\NoConstructorContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php index bdd0d101ab..ed085a5ef9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php @@ -19,21 +19,21 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Container extends \Symfony\Component\DependencyInjection\Dump\AbstractContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php index 85830af78c..9733ba9c6c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php @@ -17,21 +17,21 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php index aa078ab857..1b7443352d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php @@ -17,26 +17,26 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'test' => 'getTestService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -63,7 +63,7 @@ class ProjectServiceContainer extends Container */ protected function getTestService() { - return $this->services['test'] = new \stdClass(array('only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with '."\n".'new line')); + return $this->services['test'] = new \stdClass(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with '."\n".'new line']); } public function getParameter($name) @@ -109,8 +109,8 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -126,7 +126,7 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -149,9 +149,9 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'empty_value' => '', 'some_string' => '-', - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php index 4266ad8e59..ba564b82f4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -27,20 +27,20 @@ class ProjectServiceContainer extends Container } $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'test' => 'getTestService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -67,7 +67,7 @@ class ProjectServiceContainer extends Container */ protected function getTestService() { - return $this->services['test'] = new \stdClass(('wiz'.$this->targetDirs[1]), array(('wiz'.$this->targetDirs[1]) => ($this->targetDirs[2].'/'))); + return $this->services['test'] = new \stdClass(('wiz'.$this->targetDirs[1]), [('wiz'.$this->targetDirs[1]) => ($this->targetDirs[2].'/')]); } public function getParameter($name) @@ -113,11 +113,11 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'foo' => false, 'buz' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -140,7 +140,7 @@ class ProjectServiceContainer extends Container return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -163,9 +163,9 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'bar' => __DIR__, 'baz' => (__DIR__.'/PhpDumperTest.php'), - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php index 04705a29e4..40ce06deca 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php @@ -17,25 +17,25 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'foo' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php index c8b57a7cca..664f4dd907 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php @@ -17,27 +17,27 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'service_from_anonymous_factory' => 'getServiceFromAnonymousFactoryService', 'service_with_method_call_and_factory' => 'getServiceWithMethodCallAndFactoryService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -124,10 +124,10 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'foo' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -149,9 +149,9 @@ class ProjectServiceContainer extends Container return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array( + private $normalizedParameterNames = [ 'env(foo)' => 'env(FOO)', - ); + ]; private function normalizeParameterName($name) { @@ -174,8 +174,8 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'env(FOO)' => 'Bar\\FaooClass', - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php index 1be6319eef..b277ddd1c2 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php @@ -17,24 +17,24 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'foo' => 'getFooService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php index d6256008f6..595d12ba60 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php @@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Symfony_DI_PhpDumper_Test_EnvParameters extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -27,21 +27,21 @@ class Symfony_DI_PhpDumper_Test_EnvParameters extends Container } $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'test' => 'getTestService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -126,14 +126,14 @@ class Symfony_DI_PhpDumper_Test_EnvParameters extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'bar' => false, 'baz' => false, 'json' => false, 'db_dsn' => false, 'env(json_file)' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -159,10 +159,10 @@ class Symfony_DI_PhpDumper_Test_EnvParameters extends Container return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array( + private $normalizedParameterNames = [ 'env(foo)' => 'env(FOO)', 'env(db)' => 'env(DB)', - ); + ]; private function normalizeParameterName($name) { @@ -185,10 +185,10 @@ class Symfony_DI_PhpDumper_Test_EnvParameters extends Container */ protected function getDefaultParameters() { - return array( + return [ 'project_dir' => '/foo/bar', 'env(FOO)' => 'foo', 'env(DB)' => 'sqlite://%project_dir%/var/data.db', - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php index 3e308c1d4d..98e34bc9b1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php @@ -17,29 +17,29 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'bar\\foo' => 'Bar\\Foo', 'foo\\foo' => 'Foo\\Foo', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'Bar\\Foo' => 'getFooService', 'Foo\\Foo' => 'getFoo2Service', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php index 285942eb11..cc78c196ac 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php @@ -17,23 +17,23 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -96,8 +96,8 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -113,7 +113,7 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -136,12 +136,12 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'foo' => 'bar', 'baz' => 'bar', 'bar' => 'foo is %foo bar', 'escape' => '@escapeme', - 'values' => array( + 'values' => [ 0 => true, 1 => false, 2 => NULL, @@ -150,7 +150,7 @@ class ProjectServiceContainer extends Container 5 => 'true', 6 => 'false', 7 => 'null', - ), - ); + ], + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index fc04f5faee..0e09ec624d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -17,19 +17,19 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { parent::__construct(new ParameterBag($this->getDefaultParameters())); - $this->normalizedIds = array( + $this->normalizedIds = [ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface', 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface', - ); - $this->syntheticIds = array( + ]; + $this->syntheticIds = [ 'request' => true, - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'bar' => 'getBarService', 'baz' => 'getBazService', 'configurator_service' => 'getConfiguratorServiceService', @@ -56,21 +56,21 @@ class ProjectServiceContainer extends Container 'service_from_static_method' => 'getServiceFromStaticMethodService', 'tagged_iterator' => 'getTaggedIteratorService', 'tagged_iterator_foo' => 'getTaggedIteratorFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'configurator_service' => true, 'configurator_service_simple' => true, 'factory_simple' => true, 'inlined' => true, 'new_factory' => true, 'tagged_iterator_foo' => true, - ); - $this->aliases = array( + ]; + $this->aliases = [ 'Psr\\Container\\ContainerInterface' => 'service_container', 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => 'service_container', 'alias_for_alias' => 'foo', 'alias_for_foo' => 'foo', - ); + ]; } /** @@ -204,11 +204,11 @@ class ProjectServiceContainer extends Container { $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}; - $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this); + $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, [$this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')], true, $this); $instance->foo = 'bar'; $instance->moo = $a; - $instance->qux = array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')); + $instance->qux = [$this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')]; $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}); $instance->initialize(); sc_configure($instance); @@ -223,9 +223,9 @@ class ProjectServiceContainer extends Container */ protected function getFoo_BazService() { - $this->services['foo.baz'] = $instance = \call_user_func(array($this->getParameter('baz_class'), 'getInstance')); + $this->services['foo.baz'] = $instance = \call_user_func([$this->getParameter('baz_class'), 'getInstance']); - \call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance); + \call_user_func([$this->getParameter('baz_class'), 'configureStatic1'], $instance); return $instance; } @@ -434,10 +434,10 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'baz_class' => 'BazClass', 'foo_class' => 'Bar\\FooClass', 'foo' => 'bar', - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt index fa032cbc1f..2dc415ced4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt @@ -2,7 +2,7 @@ Array ( [Container%s/removed-ids.php] => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'configurator_service' => true, @@ -13,7 +13,7 @@ return array( 'inlined' => true, 'new_factory' => true, 'tagged_iterator_foo' => true, -); +]; [Container%s/getBazService.php] => services['foo.baz']) ? $this->services['foo.baz'] : $this->load('getFoo_BazService.php')) && false ?: '_'}; -$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this); +$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, ['bar' => 'foo is bar', 'foobar' => 'bar'], true, $this); $instance->foo = 'bar'; $instance->moo = $a; -$instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar'); +$instance->qux = ['bar' => 'foo is bar', 'foobar' => 'bar']; $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}); $instance->initialize(); sc_configure($instance); @@ -278,9 +278,9 @@ class ProjectServiceContainer extends Container private $buildParameters; private $containerDir; private $parameters; - private $targetDirs = array(); + private $targetDirs = []; - public function __construct(array $buildParameters = array(), $containerDir = __DIR__) + public function __construct(array $buildParameters = [], $containerDir = __DIR__) { $dir = $this->targetDirs[0] = \dirname($containerDir); for ($i = 1; $i <= 5; ++$i) { @@ -290,15 +290,15 @@ class ProjectServiceContainer extends Container $this->containerDir = $containerDir; $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->syntheticIds = array( + $this->services = []; + $this->syntheticIds = [ 'request' => true, - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'bar' => 'getBarService', 'foo_bar' => 'getFooBarService', - ); - $this->fileMap = array( + ]; + $this->fileMap = [ 'baz' => 'getBazService.php', 'configured_service' => 'getConfiguredServiceService.php', 'configured_service_simple' => 'getConfiguredServiceSimpleService.php', @@ -318,16 +318,16 @@ class ProjectServiceContainer extends Container 'service_from_static_method' => 'getServiceFromStaticMethodService.php', 'tagged_iterator' => 'getTaggedIteratorService.php', 'tagged_iterator_foo' => 'getTaggedIteratorFooService.php', - ); - $this->privates = array( + ]; + $this->privates = [ 'factory_simple' => true, 'tagged_iterator_foo' => true, - ); - $this->aliases = array( + ]; + $this->aliases = [ 'alias_for_alias' => 'foo', 'alias_for_foo' => 'foo', 'decorated' => 'decorator_service_with_name', - ); + ]; } public function getRemovedIds() @@ -435,8 +435,8 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -452,7 +452,7 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -475,11 +475,11 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'baz_class' => 'BazClass', 'foo_class' => 'Bar\\FooClass', 'foo' => 'bar', - ); + ]; } } @@ -499,10 +499,10 @@ if (!\class_exists(ProjectServiceContainer::class, false)) { \class_alias(\Container%s\ProjectServiceContainer::class, ProjectServiceContainer::class, false); } -return new \Container%s\ProjectServiceContainer(array( +return new \Container%s\ProjectServiceContainer([ 'container.build_hash' => '%s', 'container.build_id' => '%s', 'container.build_time' => %d, -), __DIR__.\DIRECTORY_SEPARATOR.'Container%s'); +], __DIR__.\DIRECTORY_SEPARATOR.'Container%s'); ) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index b741950fa6..02e0680da0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -17,17 +17,17 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->syntheticIds = array( + $this->services = []; + $this->syntheticIds = [ 'request' => true, - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'bar' => 'getBarService', 'baz' => 'getBazService', 'configured_service' => 'getConfiguredServiceService', @@ -49,21 +49,21 @@ class ProjectServiceContainer extends Container 'service_from_static_method' => 'getServiceFromStaticMethodService', 'tagged_iterator' => 'getTaggedIteratorService', 'tagged_iterator_foo' => 'getTaggedIteratorFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'factory_simple' => true, 'tagged_iterator_foo' => true, - ); - $this->aliases = array( + ]; + $this->aliases = [ 'alias_for_alias' => 'foo', 'alias_for_foo' => 'foo', 'decorated' => 'decorator_service_with_name', - ); + ]; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'configurator_service' => true, @@ -74,7 +74,7 @@ class ProjectServiceContainer extends Container 'inlined' => true, 'new_factory' => true, 'tagged_iterator_foo' => true, - ); + ]; } public function compile() @@ -218,11 +218,11 @@ class ProjectServiceContainer extends Container { $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}; - $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this); + $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, ['bar' => 'foo is bar', 'foobar' => 'bar'], true, $this); $instance->foo = 'bar'; $instance->moo = $a; - $instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar'); + $instance->qux = ['bar' => 'foo is bar', 'foobar' => 'bar']; $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}); $instance->initialize(); sc_configure($instance); @@ -426,8 +426,8 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -443,7 +443,7 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -466,10 +466,10 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'baz_class' => 'BazClass', 'foo_class' => 'Bar\\FooClass', 'foo' => 'bar', - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_adawson.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_adawson.php index 37b95567ce..f222fc6e60 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_adawson.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_adawson.php @@ -17,12 +17,12 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'app\\bus' => 'App\\Bus', 'app\\db' => 'App\\Db', 'app\\handler1' => 'App\\Handler1', @@ -30,8 +30,8 @@ class ProjectServiceContainer extends Container 'app\\processor' => 'App\\Processor', 'app\\registry' => 'App\\Registry', 'app\\schema' => 'App\\Schema', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'App\\Bus' => 'getBusService', 'App\\Db' => 'getDbService', 'App\\Handler1' => 'getHandler1Service', @@ -39,21 +39,21 @@ class ProjectServiceContainer extends Container 'App\\Processor' => 'getProcessorService', 'App\\Registry' => 'getRegistryService', 'App\\Schema' => 'getSchemaService', - ); - $this->privates = array( + ]; + $this->privates = [ 'App\\Handler1' => true, 'App\\Handler2' => true, 'App\\Processor' => true, 'App\\Registry' => true, 'App\\Schema' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'App\\Handler1' => true, 'App\\Handler2' => true, 'App\\Processor' => true, @@ -61,7 +61,7 @@ class ProjectServiceContainer extends Container 'App\\Schema' => true, 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -167,7 +167,7 @@ class ProjectServiceContainer extends Container { $this->services['App\Registry'] = $instance = new \App\Registry(); - $instance->processor = array(0 => ${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}, 1 => ${($_ = isset($this->services['App\Bus']) ? $this->services['App\Bus'] : $this->getBusService()) && false ?: '_'}); + $instance->processor = [0 => ${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}, 1 => ${($_ = isset($this->services['App\Bus']) ? $this->services['App\Bus'] : $this->getBusService()) && false ?: '_'}]; return $instance; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php index 8aa4a2c406..5345aa3b30 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php @@ -17,12 +17,12 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Symfony_DI_PhpDumper_Test_Almost_Circular_Private extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar2' => 'getBar2Service', 'bar3' => 'getBar3Service', 'bar6' => 'getBar6Service', @@ -45,8 +45,8 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Private extends Container 'multiuse1' => 'getMultiuse1Service', 'root' => 'getRootService', 'subscriber' => 'getSubscriberService', - ); - $this->privates = array( + ]; + $this->privates = [ 'bar6' => true, 'level2' => true, 'level3' => true, @@ -54,14 +54,14 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Private extends Container 'level5' => true, 'level6' => true, 'multiuse1' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar' => true, @@ -83,7 +83,7 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Private extends Container 'logger2' => true, 'multiuse1' => true, 'subscriber2' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php index a5de37f12c..b569b335fc 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php @@ -17,12 +17,12 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'bar3' => 'getBar3Service', 'bar5' => 'getBar5Service', @@ -52,8 +52,8 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container 'multiuse1' => 'getMultiuse1Service', 'root' => 'getRootService', 'subscriber' => 'getSubscriberService', - ); - $this->privates = array( + ]; + $this->privates = [ 'bar6' => true, 'level2' => true, 'level3' => true, @@ -61,14 +61,14 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container 'level5' => true, 'level6' => true, 'multiuse1' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar2' => true, @@ -83,7 +83,7 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container 'logger2' => true, 'multiuse1' => true, 'subscriber2' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php index 5ef6cb6882..be59456b0f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php @@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -27,20 +27,20 @@ class ProjectServiceContainer extends Container } $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -117,10 +117,10 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'array_2' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -134,9 +134,9 @@ class ProjectServiceContainer extends Container private function getDynamicParameter($name) { switch ($name) { - case 'array_2': $value = array( + case 'array_2': $value = [ 0 => ($this->targetDirs[2].'/Dumper'), - ); break; + ]; break; default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } $this->loadedDynamicParameters[$name] = true; @@ -144,7 +144,7 @@ class ProjectServiceContainer extends Container return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -167,10 +167,10 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( - 'array_1' => array( + return [ + 'array_1' => [ 0 => 123, - ), - ); + ], + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php index 6b6be95697..8582c3e2df 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php @@ -17,23 +17,23 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -96,10 +96,10 @@ class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'hello' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -121,7 +121,7 @@ class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -144,8 +144,8 @@ class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container */ protected function getDefaultParameters() { - return array( + return [ 'env(foo)' => 'd29ybGQ=', - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dedup_lazy_proxy.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dedup_lazy_proxy.php index 73a7f259f8..ec3c8028bb 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dedup_lazy_proxy.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dedup_lazy_proxy.php @@ -17,25 +17,25 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'foo' => 'getFooService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_deep_graph.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_deep_graph.php index 9a1d1ab8c3..4158fc6288 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_deep_graph.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_deep_graph.php @@ -17,25 +17,25 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Symfony_DI_PhpDumper_Test_Deep_Graph extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'foo' => 'getFooService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php index dab23e1dbc..ad76566b1a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php @@ -17,36 +17,36 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'bar_%env(bar)%' => 'bar_%env(BAR)%', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'bar' => 'getBarService', 'bar_%env(BAR)%' => 'getBarenvBARService', 'foo' => 'getFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'bar_%env(BAR)%' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar_%env(BAR)%' => true, 'baz_%env(BAR)%' => true, - ); + ]; } public function compile() @@ -83,7 +83,7 @@ class ProjectServiceContainer extends Container */ protected function getFooService() { - return $this->services['foo'] = new \stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : ($this->services['bar_%env(BAR)%'] = new \stdClass())) && false ?: '_'}, array('baz_'.$this->getEnv('string:BAR') => new \stdClass())); + return $this->services['foo'] = new \stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : ($this->services['bar_%env(BAR)%'] = new \stdClass())) && false ?: '_'}, ['baz_'.$this->getEnv('string:BAR') => new \stdClass()]); } /** @@ -139,8 +139,8 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -156,9 +156,9 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array( + private $normalizedParameterNames = [ 'env(bar)' => 'env(BAR)', - ); + ]; private function normalizeParameterName($name) { @@ -181,8 +181,8 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'env(BAR)' => 'bar', - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php index c6927eb95d..a23a693674 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php @@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -27,24 +27,24 @@ class ProjectServiceContainer extends Container } $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c1' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1', 'symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c2' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2', 'symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c3' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3', 'symfony\\component\\dependencyinjection\\tests\\fixtures\\parentnotexists' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists' => 'getParentNotExistsService', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1' => 'getC1Service', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2' => 'getC2Service', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => 'getC3Service', - ); - $this->privates = array( + ]; + $this->privates = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; $this->privates['service_container'] = function () { include_once $this->targetDirs[1].'/includes/HotPath/I1.php'; @@ -56,11 +56,11 @@ class ProjectServiceContainer extends Container public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => true, - ); + ]; } public function compile() @@ -168,8 +168,8 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -185,7 +185,7 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -208,8 +208,8 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'inline_requires' => true, - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_self_ref.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_self_ref.php index fa8a4e6908..a2573eae6d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_self_ref.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_self_ref.php @@ -17,27 +17,27 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Symfony_DI_PhpDumper_Test_Inline_Self_Ref extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'app\\foo' => 'App\\Foo', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'App\\Foo' => 'getFooService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_legacy_privates.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_legacy_privates.php index d720ae396f..30dd2c9ba9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_legacy_privates.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_legacy_privates.php @@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Symfony_DI_PhpDumper_Test_Legacy_Privates extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -25,8 +25,8 @@ class Symfony_DI_PhpDumper_Test_Legacy_Privates extends Container for ($i = 1; $i <= 5; ++$i) { $this->targetDirs[$i] = $dir = \dirname($dir); } - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'private' => 'getPrivateService', 'private_alias' => 'getPrivateAliasService', @@ -37,8 +37,8 @@ class Symfony_DI_PhpDumper_Test_Legacy_Privates extends Container 'private_not_removed' => 'getPrivateNotRemovedService', 'private_parent' => 'getPrivateParentService', 'public_child' => 'getPublicChildService', - ); - $this->privates = array( + ]; + $this->privates = [ 'decorated_private' => true, 'decorated_private_alias' => true, 'private' => true, @@ -47,17 +47,17 @@ class Symfony_DI_PhpDumper_Test_Legacy_Privates extends Container 'private_not_inlined' => true, 'private_not_removed' => true, 'private_parent' => true, - ); - $this->aliases = array( + ]; + $this->aliases = [ 'alias_to_private' => 'private', 'decorated_private' => 'private_decorator', 'decorated_private_alias' => 'private_alias_decorator', - ); + ]; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'decorated_private' => true, @@ -71,7 +71,7 @@ class Symfony_DI_PhpDumper_Test_Legacy_Privates extends Container 'private_not_inlined' => true, 'private_not_removed' => true, 'private_parent' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php index c436aea407..4969b2db09 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php @@ -17,12 +17,12 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar_service' => 'getBarServiceService', 'baz_service' => 'getBazServiceService', 'foo_service' => 'getFooServiceService', @@ -32,24 +32,24 @@ class ProjectServiceContainer extends Container 'translator_1' => 'getTranslator1Service', 'translator_2' => 'getTranslator2Service', 'translator_3' => 'getTranslator3Service', - ); - $this->privates = array( + ]; + $this->privates = [ 'baz_service' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'baz_service' => true, 'translator.loader_1_locator' => true, 'translator.loader_2_locator' => true, 'translator.loader_3_locator' => true, - ); + ]; } public function compile() @@ -86,13 +86,13 @@ class ProjectServiceContainer extends Container */ protected function getFooServiceService() { - return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\ServiceLocator(array('bar' => function () { + return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\ServiceLocator(['bar' => function () { return ${($_ = isset($this->services['bar_service']) ? $this->services['bar_service'] : $this->getBarServiceService()) && false ?: '_'}; }, 'baz' => function () { $f = function (\stdClass $v) { return $v; }; return $f(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new \stdClass())) && false ?: '_'}); }, 'nil' => function () { return NULL; - })); + }]); } /** @@ -132,9 +132,9 @@ class ProjectServiceContainer extends Container */ protected function getTranslator1Service() { - return $this->services['translator_1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(array('translator.loader_1' => function () { + return $this->services['translator_1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_1' => function () { return ${($_ = isset($this->services['translator.loader_1']) ? $this->services['translator.loader_1'] : ($this->services['translator.loader_1'] = new \stdClass())) && false ?: '_'}; - }))); + }])); } /** @@ -144,9 +144,9 @@ class ProjectServiceContainer extends Container */ protected function getTranslator2Service() { - $this->services['translator_2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(array('translator.loader_2' => function () { + $this->services['translator_2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_2' => function () { return ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : ($this->services['translator.loader_2'] = new \stdClass())) && false ?: '_'}; - }))); + }])); $instance->addResource('db', ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : ($this->services['translator.loader_2'] = new \stdClass())) && false ?: '_'}, 'nl'); @@ -160,9 +160,9 @@ class ProjectServiceContainer extends Container */ protected function getTranslator3Service() { - $this->services['translator_3'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(array('translator.loader_3' => function () { + $this->services['translator_3'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_3' => function () { return ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : ($this->services['translator.loader_3'] = new \stdClass())) && false ?: '_'}; - }))); + }])); $a = ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : ($this->services['translator.loader_3'] = new \stdClass())) && false ?: '_'}; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php index 6c3b140506..b56063a184 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php @@ -17,31 +17,31 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'foo' => 'getFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'bar' => true, 'foo' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar' => true, 'foo' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_frozen.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_frozen.php index 8ef589c127..da1d716c58 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_frozen.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_frozen.php @@ -17,30 +17,30 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar_service' => 'getBarServiceService', 'baz_service' => 'getBazServiceService', 'foo_service' => 'getFooServiceService', - ); - $this->privates = array( + ]; + $this->privates = [ 'baz_service' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'baz_service' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_in_expression.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_in_expression.php index 75cbc2730b..c7fb579b07 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_in_expression.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_in_expression.php @@ -17,30 +17,30 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'private_foo' => 'getPrivateFooService', 'public_foo' => 'getPublicFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'private_foo' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'private_bar' => true, 'private_foo' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php index efbb002316..7c903b11d0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php @@ -17,30 +17,30 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'symfony\\component\\dependencyinjection\\tests\\dumper\\rot13envvarprocessor' => 'Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor' => 'getRot13EnvVarProcessorService', 'container.env_var_processors_locator' => 'getContainer_EnvVarProcessorsLocatorService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -77,9 +77,9 @@ class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container */ protected function getContainer_EnvVarProcessorsLocatorService() { - return $this->services['container.env_var_processors_locator'] = new \Symfony\Component\DependencyInjection\ServiceLocator(array('rot13' => function () { + return $this->services['container.env_var_processors_locator'] = new \Symfony\Component\DependencyInjection\ServiceLocator(['rot13' => function () { return ${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] = new \Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor())) && false ?: '_'}; - })); + }]); } public function getParameter($name) @@ -125,10 +125,10 @@ class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'hello' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. @@ -150,7 +150,7 @@ class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -173,8 +173,8 @@ class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container */ protected function getDefaultParameters() { - return array( + return [ 'env(foo)' => 'jbeyq', - ); + ]; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php index 8f198f0ba8..9424a76114 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php @@ -17,36 +17,36 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'symfony\\component\\dependencyinjection\\tests\\fixtures\\customdefinition' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'symfony\\component\\dependencyinjection\\tests\\fixtures\\testservicesubscriber' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'getCustomDefinitionService', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'getTestServiceSubscriberService', 'foo_service' => 'getFooServiceService', - ); - $this->privates = array( + ]; + $this->privates = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true, 'service_locator.jmktfsv' => true, 'service_locator.jmktfsv.foo_service' => true, - ); + ]; } public function compile() @@ -83,7 +83,7 @@ class ProjectServiceContainer extends Container */ protected function getFooServiceService() { - return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \Symfony\Component\DependencyInjection\ServiceLocator(array('Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function () { + return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \Symfony\Component\DependencyInjection\ServiceLocator(['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function () { $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition())) && false ?: '_'}); }, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => function () { $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && false ?: '_'}); @@ -91,7 +91,7 @@ class ProjectServiceContainer extends Container $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && false ?: '_'}); }, 'baz' => function () { $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition())) && false ?: '_'}); - })))->withContext('foo_service', $this)); + }]))->withContext('foo_service', $this)); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_tsantos.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_tsantos.php index dbaa70956d..b14cdebb96 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_tsantos.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_tsantos.php @@ -17,28 +17,28 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'tsantos\\serializer\\serializerinterface' => 'TSantos\\Serializer\\SerializerInterface', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'tsantos_serializer' => 'getTsantosSerializerService', - ); - $this->aliases = array( + ]; + $this->aliases = [ 'TSantos\\Serializer\\SerializerInterface' => 'tsantos_serializer', - ); + ]; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_uninitialized_ref.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_uninitialized_ref.php index c53e336d27..7a24f72c59 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_uninitialized_ref.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_uninitialized_ref.php @@ -17,32 +17,32 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; class Symfony_DI_PhpDumper_Test_Uninitialized_Reference extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'baz' => 'getBazService', 'foo1' => 'getFoo1Service', 'foo3' => 'getFoo3Service', - ); - $this->privates = array( + ]; + $this->privates = [ 'foo3' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'foo2' => true, 'foo3' => true, - ); + ]; } public function compile() @@ -74,13 +74,13 @@ class Symfony_DI_PhpDumper_Test_Uninitialized_Reference extends Container $instance->foo1 = ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && false ?: '_'}; $instance->foo2 = null; $instance->foo3 = ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && false ?: '_'}; - $instance->closures = array(0 => function () { + $instance->closures = [0 => function () { return ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && false ?: '_'}; }, 1 => function () { return null; }, 2 => function () { return ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && false ?: '_'}; - }); + }]; $instance->iter = new RewindableGenerator(function () { if (isset($this->services['foo1'])) { yield 'foo1' => ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && false ?: '_'};