Skip to content

Commit b030f98

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: fixed tests fixed CS fixed CS fixed CS fixed short array CS in comments fixed CS in ExpressionLanguage fixtures fixed CS in generated files fixed CS on generated container files fixed CS on Form PHP templates fixed CS on YAML fixtures fixed fixtures switched array() to []
2 parents ae3a789 + 7aa47f7 commit b030f98

File tree

114 files changed

+1252
-1252
lines changed

Some content is hidden

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

114 files changed

+1252
-1252
lines changed

Argument/BoundArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($value, bool $trackUsage = true)
3737
*/
3838
public function getValues()
3939
{
40-
return array($this->value, $this->identifier, $this->used);
40+
return [$this->value, $this->identifier, $this->used];
4141
}
4242

4343
/**

Argument/ServiceClosureArgument.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ServiceClosureArgument implements ArgumentInterface
2525

2626
public function __construct(Reference $reference)
2727
{
28-
$this->values = array($reference);
28+
$this->values = [$reference];
2929
}
3030

3131
/**
@@ -41,7 +41,7 @@ public function getValues()
4141
*/
4242
public function setValues(array $values)
4343
{
44-
if (array(0) !== array_keys($values) || !($values[0] instanceof Reference || null === $values[0])) {
44+
if ([0] !== array_keys($values) || !($values[0] instanceof Reference || null === $values[0])) {
4545
throw new InvalidArgumentException('A ServiceClosureArgument must hold one and only one Reference.');
4646
}
4747

Argument/TaggedIteratorArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TaggedIteratorArgument extends IteratorArgument
2222

2323
public function __construct(string $tag)
2424
{
25-
parent::__construct(array());
25+
parent::__construct([]);
2626

2727
$this->tag = $tag;
2828
}

Compiler/AutowirePass.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private function doProcessValue($value, $isRoot = false)
117117
}
118118

119119
if ($constructor) {
120-
array_unshift($this->methodCalls, array($constructor, $value->getArguments()));
120+
array_unshift($this->methodCalls, [$constructor, $value->getArguments()]);
121121
}
122122

123123
$this->methodCalls = $this->autowireCalls($reflectionClass, $isRoot);
@@ -309,8 +309,8 @@ private function getAutowiredReference(TypedReference $reference)
309309
*/
310310
private function populateAvailableTypes()
311311
{
312-
$this->types = array();
313-
$this->ambiguousServiceTypes = array();
312+
$this->types = [];
313+
$this->ambiguousServiceTypes = [];
314314

315315
foreach ($this->container->getDefinitions() as $id => $definition) {
316316
$this->populateAvailableType($id, $definition);
@@ -361,7 +361,7 @@ private function set(string $type, string $id)
361361

362362
// keep an array of all services matching this type
363363
if (!isset($this->ambiguousServiceTypes[$type])) {
364-
$this->ambiguousServiceTypes[$type] = array($this->types[$type]);
364+
$this->ambiguousServiceTypes[$type] = [$this->types[$type]];
365365
unset($this->types[$type]);
366366
}
367367
$this->ambiguousServiceTypes[$type][] = $id;
@@ -436,7 +436,7 @@ private function createTypeAlternatives(TypedReference $reference)
436436

437437
private function getAliasesSuggestionForType($type, $extraContext = null)
438438
{
439-
$aliases = array();
439+
$aliases = [];
440440
foreach (class_parents($type) + class_implements($type) as $parent) {
441441
if ($this->container->has($parent) && !$this->container->findDefinition($parent)->isAbstract()) {
442442
$aliases[] = $parent;

Compiler/AutowireRequiredMethodsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function processValue($value, $isRoot = false)
3434
return $value;
3535
}
3636

37-
$alreadyCalledMethods = array();
37+
$alreadyCalledMethods = [];
3838

3939
foreach ($value->getMethodCalls() as list($method)) {
4040
$alreadyCalledMethods[strtolower($method)] = true;

Compiler/CheckCircularReferencesPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public function process(ContainerBuilder $container)
3636
{
3737
$graph = $container->getCompiler()->getServiceReferenceGraph();
3838

39-
$this->checkedNodes = array();
39+
$this->checkedNodes = [];
4040
foreach ($graph->getNodes() as $id => $node) {
41-
$this->currentPath = array($id);
41+
$this->currentPath = [$id];
4242

4343
$this->checkOutEdges($node->getOutEdges());
4444
}

Compiler/CheckDefinitionValidityPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function process(ContainerBuilder $container)
8383
if ($definition->isPublic() && !$definition->isPrivate()) {
8484
$resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs);
8585
if (null !== $usedEnvs) {
86-
throw new EnvParameterException(array($resolvedId), null, 'A service name ("%s") cannot contain dynamic values.');
86+
throw new EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.');
8787
}
8888
}
8989
}
@@ -92,7 +92,7 @@ public function process(ContainerBuilder $container)
9292
if ($alias->isPublic() && !$alias->isPrivate()) {
9393
$resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs);
9494
if (null !== $usedEnvs) {
95-
throw new EnvParameterException(array($resolvedId), null, 'An alias name ("%s") cannot contain dynamic values.');
95+
throw new EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.');
9696
}
9797
}
9898
}

Compiler/Compiler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class Compiler
2323
{
2424
private $passConfig;
25-
private $log = array();
25+
private $log = [];
2626
private $serviceReferenceGraph;
2727

2828
public function __construct()
@@ -95,7 +95,7 @@ public function compile(ContainerBuilder $container)
9595
$pass->process($container);
9696
}
9797
} catch (\Exception $e) {
98-
$usedEnvs = array();
98+
$usedEnvs = [];
9999
$prev = $e;
100100

101101
do {

Compiler/DecoratorServicePass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public function process(ContainerBuilder $container)
3232
if (!$decorated = $definition->getDecoratedService()) {
3333
continue;
3434
}
35-
$definitions->insert(array($id, $definition), array($decorated[2], --$order));
35+
$definitions->insert([$id, $definition], [$decorated[2], --$order]);
3636
}
37-
$decoratingDefinitions = array();
37+
$decoratingDefinitions = [];
3838

3939
foreach ($definitions as list($id, $definition)) {
4040
list($inner, $renamedId) = $definition->getDecoratedService();
@@ -65,7 +65,7 @@ public function process(ContainerBuilder $container)
6565
if (isset($decoratingDefinitions[$inner])) {
6666
$decoratingDefinition = $decoratingDefinitions[$inner];
6767
$definition->setTags(array_merge($decoratingDefinition->getTags(), $definition->getTags()));
68-
$decoratingDefinition->setTags(array());
68+
$decoratingDefinition->setTags([]);
6969
$decoratingDefinitions[$inner] = $definition;
7070
}
7171

Compiler/MergeExtensionConfigurationPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function freezeAfterProcessing(Extension $extension, ContainerBuilder $co
119119
// Extension::processConfiguration() wasn't called, we cannot know how configs were merged
120120
return;
121121
}
122-
$this->processedEnvPlaceholders = array();
122+
$this->processedEnvPlaceholders = [];
123123

124124
// serialize config and container to catch env vars nested in object graphs
125125
$config = serialize($config).serialize($container->getDefinitions()).serialize($container->getAliases()).serialize($container->getParameterBag()->all());
@@ -144,7 +144,7 @@ public function getEnvPlaceholders()
144144

145145
public function getUnusedEnvPlaceholders(): array
146146
{
147-
return null === $this->processedEnvPlaceholders ? array() : array_diff_key(parent::getEnvPlaceholders(), $this->processedEnvPlaceholders);
147+
return null === $this->processedEnvPlaceholders ? [] : array_diff_key(parent::getEnvPlaceholders(), $this->processedEnvPlaceholders);
148148
}
149149
}
150150

Compiler/PriorityTaggedServiceTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ trait PriorityTaggedServiceTrait
3838
*/
3939
private function findAndSortTaggedServices($tagName, ContainerBuilder $container)
4040
{
41-
$services = array();
41+
$services = [];
4242

4343
foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) {
4444
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;

Compiler/RegisterServiceSubscribersPass.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function processValue($value, $isRoot = false)
3131
return parent::processValue($value, $isRoot);
3232
}
3333

34-
$serviceMap = array();
34+
$serviceMap = [];
3535
$autowire = $value->isAutowired();
3636

3737
foreach ($value->getTag('container.service_subscriber') as $attributes) {
@@ -40,7 +40,7 @@ protected function processValue($value, $isRoot = false)
4040
continue;
4141
}
4242
ksort($attributes);
43-
if (array() !== array_diff(array_keys($attributes), array('id', 'key'))) {
43+
if ([] !== array_diff(array_keys($attributes), ['id', 'key'])) {
4444
throw new InvalidArgumentException(sprintf('The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "%s" given for service "%s".', implode('", "', array_keys($attributes)), $this->currentId));
4545
}
4646
if (!array_key_exists('id', $attributes)) {
@@ -64,7 +64,7 @@ protected function processValue($value, $isRoot = false)
6464
}
6565
$class = $r->name;
6666

67-
$subscriberMap = array();
67+
$subscriberMap = [];
6868

6969
foreach ($class::getSubscribedServices() as $key => $type) {
7070
if (!\is_string($type) || !preg_match('/^\??[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+$/', $type)) {
@@ -105,7 +105,7 @@ protected function processValue($value, $isRoot = false)
105105
throw new InvalidArgumentException(sprintf('Service %s not exist in the map returned by "%s::getSubscribedServices()" for service "%s".', $message, $class, $this->currentId));
106106
}
107107

108-
$value->addTag('container.service_subscriber.locator', array('id' => (string) ServiceLocatorTagPass::register($this->container, $subscriberMap, $this->currentId)));
108+
$value->addTag('container.service_subscriber.locator', ['id' => (string) ServiceLocatorTagPass::register($this->container, $subscriberMap, $this->currentId)]);
109109

110110
return parent::processValue($value);
111111
}

Compiler/ReplaceAliasByActualDefinitionPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class ReplaceAliasByActualDefinitionPass extends AbstractRecursivePass
3434
public function process(ContainerBuilder $container)
3535
{
3636
// First collect all alias targets that need to be replaced
37-
$seenAliasTargets = array();
38-
$replacements = array();
37+
$seenAliasTargets = [];
38+
$replacements = [];
3939
foreach ($container->getAliases() as $definitionId => $target) {
4040
$targetId = (string) $target;
4141
// Special case: leave this target alone
@@ -74,7 +74,7 @@ public function process(ContainerBuilder $container)
7474
$this->replacements = $replacements;
7575

7676
parent::process($container);
77-
$this->replacements = array();
77+
$this->replacements = [];
7878
}
7979

8080
/**

Compiler/ResolveBindingsPass.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
*/
2626
class ResolveBindingsPass extends AbstractRecursivePass
2727
{
28-
private $usedBindings = array();
29-
private $unusedBindings = array();
30-
private $errorMessages = array();
28+
private $usedBindings = [];
29+
private $unusedBindings = [];
30+
private $errorMessages = [];
3131

3232
/**
3333
* {@inheritdoc}
@@ -48,9 +48,9 @@ public function process(ContainerBuilder $container)
4848
throw new InvalidArgumentException($message);
4949
}
5050
} finally {
51-
$this->usedBindings = array();
52-
$this->unusedBindings = array();
53-
$this->errorMessages = array();
51+
$this->usedBindings = [];
52+
$this->unusedBindings = [];
53+
$this->errorMessages = [];
5454
}
5555
}
5656

@@ -80,7 +80,7 @@ protected function processValue($value, $isRoot = false)
8080
$this->usedBindings[$bindingId] = true;
8181
unset($this->unusedBindings[$bindingId]);
8282
} elseif (!isset($this->usedBindings[$bindingId])) {
83-
$this->unusedBindings[$bindingId] = array($key, $this->currentId);
83+
$this->unusedBindings[$bindingId] = [$key, $this->currentId];
8484
}
8585

8686
if (preg_match('/^(?:(?:array|bool|float|int|string) )?\$/', $key)) {
@@ -100,7 +100,7 @@ protected function processValue($value, $isRoot = false)
100100

101101
try {
102102
if ($constructor = $this->getConstructor($value, false)) {
103-
$calls[] = array($constructor, $value->getArguments());
103+
$calls[] = [$constructor, $value->getArguments()];
104104
}
105105
} catch (RuntimeException $e) {
106106
$this->errorMessages[] = $e->getMessage();

Compiler/ResolveChildDefinitionsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function processValue($value, $isRoot = false)
3939
$value = $this->container->getDefinition($this->currentId);
4040
}
4141
if ($value instanceof ChildDefinition) {
42-
$this->currentPath = array();
42+
$this->currentPath = [];
4343
$value = $this->resolveDefinition($value);
4444
if ($isRoot) {
4545
$this->container->setDefinition($this->currentId, $value);

Compiler/ResolveHotPathPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class ResolveHotPathPass extends AbstractRecursivePass
2525
{
2626
private $tagName;
27-
private $resolvedIds = array();
27+
private $resolvedIds = [];
2828

2929
public function __construct($tagName = 'container.hot_path')
3030
{
@@ -40,7 +40,7 @@ public function process(ContainerBuilder $container)
4040
parent::process($container);
4141
$container->getDefinition('service_container')->clearTag($this->tagName);
4242
} finally {
43-
$this->resolvedIds = array();
43+
$this->resolvedIds = [];
4444
}
4545
}
4646

Compiler/ResolveNamedArgumentsPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ protected function processValue($value, $isRoot = false)
3333
}
3434

3535
$calls = $value->getMethodCalls();
36-
$calls[] = array('__construct', $value->getArguments());
36+
$calls[] = ['__construct', $value->getArguments()];
3737

3838
foreach ($calls as $i => $call) {
3939
list($method, $arguments) = $call;
4040
$parameters = null;
41-
$resolvedArguments = array();
41+
$resolvedArguments = [];
4242

4343
foreach ($arguments as $key => $argument) {
4444
if (\is_int($key)) {

Compiler/ResolveParameterPlaceHoldersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function process(ContainerBuilder $container)
4242
try {
4343
parent::process($container);
4444

45-
$aliases = array();
45+
$aliases = [];
4646
foreach ($container->getAliases() as $name => $target) {
4747
$this->currentId = $name;
4848
$aliases[$this->bag->resolveValue($name)] = $target;

Compiler/ResolveReferencesToAliasesPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ protected function processValue($value, $isRoot = false)
5555

5656
private function getDefinitionId(string $id, ContainerBuilder $container): string
5757
{
58-
$seen = array();
58+
$seen = [];
5959
while ($container->hasAlias($id)) {
6060
if (isset($seen[$id])) {
61-
throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), array($id)));
61+
throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), [$id]));
6262
}
6363
$seen[$id] = true;
6464
$id = (string) $container->getAlias($id);

Compiler/ServiceReferenceGraph.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ServiceReferenceGraph
2828
/**
2929
* @var ServiceReferenceGraphNode[]
3030
*/
31-
private $nodes = array();
31+
private $nodes = [];
3232

3333
public function hasNode(string $id): bool
3434
{
@@ -67,7 +67,7 @@ public function clear()
6767
foreach ($this->nodes as $node) {
6868
$node->clear();
6969
}
70-
$this->nodes = array();
70+
$this->nodes = [];
7171
}
7272

7373
/**

Compiler/ServiceReferenceGraphNode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
class ServiceReferenceGraphNode
2525
{
2626
private $id;
27-
private $inEdges = array();
28-
private $outEdges = array();
27+
private $inEdges = [];
28+
private $outEdges = [];
2929
private $value;
3030

3131
/**
@@ -113,6 +113,6 @@ public function getValue()
113113
*/
114114
public function clear()
115115
{
116-
$this->inEdges = $this->outEdges = array();
116+
$this->inEdges = $this->outEdges = [];
117117
}
118118
}

0 commit comments

Comments
 (0)