Skip to content

Commit ea1c2fd

Browse files
committed
switched array() to []
1 parent 9150ac7 commit ea1c2fd

File tree

119 files changed

+1499
-1499
lines changed

Some content is hidden

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

119 files changed

+1499
-1499
lines changed

Argument/BoundArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct($value)
3333
*/
3434
public function getValues()
3535
{
36-
return array($this->value, $this->identifier, $this->used);
36+
return [$this->value, $this->identifier, $this->used];
3737
}
3838

3939
/**

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
@@ -25,7 +25,7 @@ class TaggedIteratorArgument extends IteratorArgument
2525
*/
2626
public function __construct($tag)
2727
{
28-
parent::__construct(array());
28+
parent::__construct([]);
2929

3030
$this->tag = (string) $tag;
3131
}

Compiler/AnalyzeServiceReferencesPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function processValue($value, $isRoot = false)
8787
return $value;
8888
}
8989
if ($value instanceof Expression) {
90-
$this->getExpressionLanguage()->compile((string) $value, array('this' => 'container'));
90+
$this->getExpressionLanguage()->compile((string) $value, ['this' => 'container']);
9191

9292
return $value;
9393
}

Compiler/AutowirePass.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
*/
2929
class AutowirePass extends AbstractRecursivePass
3030
{
31-
private $definedTypes = array();
31+
private $definedTypes = [];
3232
private $types;
3333
private $ambiguousServiceTypes;
34-
private $autowired = array();
34+
private $autowired = [];
3535
private $lastFailure;
3636
private $throwOnAutowiringException;
37-
private $autowiringExceptions = array();
37+
private $autowiringExceptions = [];
3838
private $strictMode;
3939

4040
/**
@@ -63,16 +63,16 @@ public function getAutowiringExceptions()
6363
public function process(ContainerBuilder $container)
6464
{
6565
// clear out any possibly stored exceptions from before
66-
$this->autowiringExceptions = array();
66+
$this->autowiringExceptions = [];
6767
$this->strictMode = $container->hasParameter('container.autowiring.strict_mode') && $container->getParameter('container.autowiring.strict_mode');
6868

6969
try {
7070
parent::process($container);
7171
} finally {
72-
$this->definedTypes = array();
72+
$this->definedTypes = [];
7373
$this->types = null;
7474
$this->ambiguousServiceTypes = null;
75-
$this->autowired = array();
75+
$this->autowired = [];
7676
}
7777
}
7878

@@ -89,7 +89,7 @@ public static function createResourceForClass(\ReflectionClass $reflectionClass)
8989
{
9090
@trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', E_USER_DEPRECATED);
9191

92-
$metadata = array();
92+
$metadata = [];
9393

9494
foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
9595
if (!$reflectionMethod->isStatic()) {
@@ -147,7 +147,7 @@ private function doProcessValue($value, $isRoot = false)
147147
}
148148

149149
if ($constructor) {
150-
array_unshift($methodCalls, array($constructor, $value->getArguments()));
150+
array_unshift($methodCalls, [$constructor, $value->getArguments()]);
151151
}
152152

153153
$methodCalls = $this->autowireCalls($reflectionClass, $methodCalls);
@@ -327,9 +327,9 @@ private function getAutowiredReference(TypedReference $reference, $deprecationMe
327327
*/
328328
private function populateAvailableTypes($onlyAutowiringTypes = false)
329329
{
330-
$this->types = array();
330+
$this->types = [];
331331
if (!$onlyAutowiringTypes) {
332-
$this->ambiguousServiceTypes = array();
332+
$this->ambiguousServiceTypes = [];
333333
}
334334

335335
foreach ($this->container->getDefinitions() as $id => $definition) {
@@ -401,7 +401,7 @@ private function set($type, $id)
401401

402402
// keep an array of all services matching this type
403403
if (!isset($this->ambiguousServiceTypes[$type])) {
404-
$this->ambiguousServiceTypes[$type] = array($this->types[$type]);
404+
$this->ambiguousServiceTypes[$type] = [$this->types[$type]];
405405
unset($this->types[$type]);
406406
}
407407
$this->ambiguousServiceTypes[$type][] = $id;
@@ -521,7 +521,7 @@ private function createTypeAlternatives(TypedReference $reference)
521521
*/
522522
private static function getResourceMetadataForMethod(\ReflectionMethod $method)
523523
{
524-
$methodArgumentsMetadata = array();
524+
$methodArgumentsMetadata = [];
525525
foreach ($method->getParameters() as $parameter) {
526526
try {
527527
$class = $parameter->getClass();
@@ -531,19 +531,19 @@ private static function getResourceMetadataForMethod(\ReflectionMethod $method)
531531
}
532532

533533
$isVariadic = method_exists($parameter, 'isVariadic') && $parameter->isVariadic();
534-
$methodArgumentsMetadata[] = array(
534+
$methodArgumentsMetadata[] = [
535535
'class' => $class,
536536
'isOptional' => $parameter->isOptional(),
537537
'defaultValue' => ($parameter->isOptional() && !$isVariadic) ? $parameter->getDefaultValue() : null,
538-
);
538+
];
539539
}
540540

541541
return $methodArgumentsMetadata;
542542
}
543543

544544
private function getAliasesSuggestionForType($type, $extraContext = null)
545545
{
546-
$aliases = array();
546+
$aliases = [];
547547
foreach (class_parents($type) + class_implements($type) as $parent) {
548548
if ($this->container->has($parent) && !$this->container->findDefinition($parent)->isAbstract()) {
549549
$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 $loggingFormatter;
2727
private $serviceReferenceGraph;
2828

@@ -141,7 +141,7 @@ public function compile(ContainerBuilder $container)
141141
$pass->process($container);
142142
}
143143
} catch (\Exception $e) {
144-
$usedEnvs = array();
144+
$usedEnvs = [];
145145
$prev = $e;
146146

147147
do {

Compiler/DecoratorServicePass.php

Lines changed: 4 additions & 4 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();
@@ -68,9 +68,9 @@ public function process(ContainerBuilder $container)
6868
if ($types = array_merge($autowiringTypes, $definition->getAutowiringTypes(false))) {
6969
$definition->setAutowiringTypes($types);
7070
}
71-
$decoratingDefinition->setTags(array());
71+
$decoratingDefinition->setTags([]);
7272
if ($autowiringTypes) {
73-
$decoratingDefinition->setAutowiringTypes(array());
73+
$decoratingDefinition->setAutowiringTypes([]);
7474
}
7575
$decoratingDefinitions[$inner] = $definition;
7676
}

Compiler/FactoryReturnTypePass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public function process(ContainerBuilder $container)
4141
if (!method_exists(\ReflectionMethod::class, 'getReturnType')) {
4242
return;
4343
}
44-
$resolveClassPassChanges = null !== $this->resolveClassPass ? $this->resolveClassPass->getChanges() : array();
44+
$resolveClassPassChanges = null !== $this->resolveClassPass ? $this->resolveClassPass->getChanges() : [];
4545

4646
foreach ($container->getDefinitions() as $id => $definition) {
4747
$this->updateDefinition($container, $id, $definition, $resolveClassPassChanges);
4848
}
4949
}
5050

51-
private function updateDefinition(ContainerBuilder $container, $id, Definition $definition, array $resolveClassPassChanges, array $previous = array())
51+
private function updateDefinition(ContainerBuilder $container, $id, Definition $definition, array $resolveClassPassChanges, array $previous = [])
5252
{
5353
// circular reference
5454
if (isset($previous[$id])) {

Compiler/InlineServiceDefinitionsPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
*/
2424
class InlineServiceDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface
2525
{
26-
private $cloningIds = array();
27-
private $inlinedServiceIds = array();
26+
private $cloningIds = [];
27+
private $inlinedServiceIds = [];
2828

2929
/**
3030
* {@inheritdoc}
@@ -126,7 +126,7 @@ private function isInlineableDefinition($id, Definition $definition, ServiceRefe
126126
return false;
127127
}
128128

129-
$ids = array();
129+
$ids = [];
130130
$isReferencedByConstructor = false;
131131
foreach ($graph->getNode($id)->getInEdges() as $edge) {
132132
$isReferencedByConstructor = $isReferencedByConstructor || $edge->isReferencedByConstructor();

Compiler/MergeExtensionConfigurationPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function freezeAfterProcessing(Extension $extension, ContainerBuilder $co
110110
// Extension::processConfiguration() wasn't called, we cannot know how configs were merged
111111
return;
112112
}
113-
$this->processedEnvPlaceholders = array();
113+
$this->processedEnvPlaceholders = [];
114114

115115
// serialize config and container to catch env vars nested in object graphs
116116
$config = serialize($config).serialize($container->getDefinitions()).serialize($container->getAliases()).serialize($container->getParameterBag()->all());

0 commit comments

Comments
 (0)