Skip to content

Commit 2a898a2

Browse files
committed
fixed CS
1 parent 1b7a2a3 commit 2a898a2

File tree

87 files changed

+1414
-1414
lines changed

Some content is hidden

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

87 files changed

+1414
-1414
lines changed

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);
@@ -291,8 +291,8 @@ private function getAutowiredReference(TypedReference $reference)
291291
*/
292292
private function populateAvailableTypes()
293293
{
294-
$this->types = array();
295-
$this->ambiguousServiceTypes = array();
294+
$this->types = [];
295+
$this->ambiguousServiceTypes = [];
296296

297297
foreach ($this->container->getDefinitions() as $id => $definition) {
298298
$this->populateAvailableType($id, $definition);
@@ -343,7 +343,7 @@ private function set(string $type, string $id)
343343

344344
// keep an array of all services matching this type
345345
if (!isset($this->ambiguousServiceTypes[$type])) {
346-
$this->ambiguousServiceTypes[$type] = array($this->types[$type]);
346+
$this->ambiguousServiceTypes[$type] = [$this->types[$type]];
347347
unset($this->types[$type]);
348348
}
349349
$this->ambiguousServiceTypes[$type][] = $id;
@@ -418,7 +418,7 @@ private function createTypeAlternatives(TypedReference $reference)
418418

419419
private function getAliasesSuggestionForType($type, $extraContext = null)
420420
{
421-
$aliases = array();
421+
$aliases = [];
422422
foreach (class_parents($type) + class_implements($type) as $parent) {
423423
if ($this->container->has($parent) && !$this->container->findDefinition($parent)->isAbstract()) {
424424
$aliases[] = $parent;

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/InlineServiceDefinitionsPass.php

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

2828
/**
2929
* {@inheritdoc}
@@ -118,7 +118,7 @@ private function isInlineableDefinition($id, Definition $definition, ServiceRefe
118118
return false;
119119
}
120120

121-
$ids = array();
121+
$ids = [];
122122
$isReferencedByConstructor = false;
123123
foreach ($graph->getNode($id)->getInEdges() as $edge) {
124124
$isReferencedByConstructor = $isReferencedByConstructor || $edge->isReferencedByConstructor();

Compiler/MergeExtensionConfigurationPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/PassConfig.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@ class PassConfig
2929
const TYPE_REMOVE = 'removing';
3030

3131
private $mergePass;
32-
private $afterRemovingPasses = array();
33-
private $beforeOptimizationPasses = array();
34-
private $beforeRemovingPasses = array();
32+
private $afterRemovingPasses = [];
33+
private $beforeOptimizationPasses = [];
34+
private $beforeRemovingPasses = [];
3535
private $optimizationPasses;
3636
private $removingPasses;
3737

3838
public function __construct()
3939
{
4040
$this->mergePass = new MergeExtensionConfigurationPass();
4141

42-
$this->beforeOptimizationPasses = array(
43-
100 => array(
42+
$this->beforeOptimizationPasses = [
43+
100 => [
4444
new ResolveClassPass(),
4545
new ResolveInstanceofConditionalsPass(),
4646
new RegisterEnvVarProcessorsPass(),
47-
),
48-
-1000 => array(new ExtensionCompilerPass()),
49-
);
47+
],
48+
-1000 => [new ExtensionCompilerPass()],
49+
];
5050

51-
$this->optimizationPasses = array(array(
51+
$this->optimizationPasses = [[
5252
new ValidateEnvPlaceholdersPass(),
5353
new ResolveChildDefinitionsPass(),
5454
new ServiceLocatorTagPass(),
@@ -69,28 +69,28 @@ public function __construct()
6969
new CheckCircularReferencesPass(),
7070
new CheckReferenceValidityPass(),
7171
new CheckArgumentsValidityPass(false),
72-
));
72+
]];
7373

74-
$this->beforeRemovingPasses = array(
75-
-100 => array(
74+
$this->beforeRemovingPasses = [
75+
-100 => [
7676
new ResolvePrivatesPass(),
77-
),
78-
);
77+
],
78+
];
7979

80-
$this->removingPasses = array(array(
80+
$this->removingPasses = [[
8181
new RemovePrivateAliasesPass(),
8282
new ReplaceAliasByActualDefinitionPass(),
8383
new RemoveAbstractDefinitionsPass(),
84-
new RepeatedPass(array(
84+
new RepeatedPass([
8585
new AnalyzeServiceReferencesPass(),
8686
new InlineServiceDefinitionsPass(),
8787
new AnalyzeServiceReferencesPass(),
8888
new RemoveUnusedDefinitionsPass(),
89-
)),
89+
]),
9090
new DefinitionErrorExceptionPass(),
9191
new CheckExceptionOnInvalidReferenceBehaviorPass(),
9292
new ResolveHotPathPass(),
93-
));
93+
]];
9494
}
9595

9696
/**
@@ -101,7 +101,7 @@ public function __construct()
101101
public function getPasses()
102102
{
103103
return array_merge(
104-
array($this->mergePass),
104+
[$this->mergePass],
105105
$this->getBeforeOptimizationPasses(),
106106
$this->getOptimizationPasses(),
107107
$this->getBeforeRemovingPasses(),
@@ -129,7 +129,7 @@ public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_O
129129
$passes = &$this->$property;
130130

131131
if (!isset($passes[$priority])) {
132-
$passes[$priority] = array();
132+
$passes[$priority] = [];
133133
}
134134
$passes[$priority][] = $pass;
135135
}
@@ -206,7 +206,7 @@ public function setMergePass(CompilerPassInterface $pass)
206206
*/
207207
public function setAfterRemovingPasses(array $passes)
208208
{
209-
$this->afterRemovingPasses = array($passes);
209+
$this->afterRemovingPasses = [$passes];
210210
}
211211

212212
/**
@@ -216,7 +216,7 @@ public function setAfterRemovingPasses(array $passes)
216216
*/
217217
public function setBeforeOptimizationPasses(array $passes)
218218
{
219-
$this->beforeOptimizationPasses = array($passes);
219+
$this->beforeOptimizationPasses = [$passes];
220220
}
221221

222222
/**
@@ -226,7 +226,7 @@ public function setBeforeOptimizationPasses(array $passes)
226226
*/
227227
public function setBeforeRemovingPasses(array $passes)
228228
{
229-
$this->beforeRemovingPasses = array($passes);
229+
$this->beforeRemovingPasses = [$passes];
230230
}
231231

232232
/**
@@ -236,7 +236,7 @@ public function setBeforeRemovingPasses(array $passes)
236236
*/
237237
public function setOptimizationPasses(array $passes)
238238
{
239-
$this->optimizationPasses = array($passes);
239+
$this->optimizationPasses = [$passes];
240240
}
241241

242242
/**
@@ -246,7 +246,7 @@ public function setOptimizationPasses(array $passes)
246246
*/
247247
public function setRemovingPasses(array $passes)
248248
{
249-
$this->removingPasses = array($passes);
249+
$this->removingPasses = [$passes];
250250
}
251251

252252
/**
@@ -259,7 +259,7 @@ public function setRemovingPasses(array $passes)
259259
private function sortPasses(array $passes)
260260
{
261261
if (0 === \count($passes)) {
262-
return array();
262+
return [];
263263
}
264264

265265
krsort($passes);

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)) {
@@ -93,7 +93,7 @@ protected function processValue($value, $isRoot = false)
9393
throw new InvalidArgumentException(sprintf('Service %s not exist in the map returned by "%s::getSubscribedServices()" for service "%s".', $message, $class, $this->currentId));
9494
}
9595

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

9898
return parent::processValue($value);
9999
}

Compiler/ResolveInstanceofConditionalsPass.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function process(ContainerBuilder $container)
4747
private function processDefinition(ContainerBuilder $container, $id, Definition $definition)
4848
{
4949
$instanceofConditionals = $definition->getInstanceofConditionals();
50-
$autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : array();
50+
$autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : [];
5151
if (!$instanceofConditionals && !$autoconfiguredInstanceof) {
5252
return $definition;
5353
}
@@ -58,10 +58,10 @@ private function processDefinition(ContainerBuilder $container, $id, Definition
5858

5959
$conditionals = $this->mergeConditionals($autoconfiguredInstanceof, $instanceofConditionals, $container);
6060

61-
$definition->setInstanceofConditionals(array());
61+
$definition->setInstanceofConditionals([]);
6262
$parent = $shared = null;
63-
$instanceofTags = array();
64-
$instanceofCalls = array();
63+
$instanceofTags = [];
64+
$instanceofCalls = [];
6565

6666
foreach ($conditionals as $interface => $instanceofDefs) {
6767
if ($interface !== $class && (!$container->getReflectionClass($class, false))) {
@@ -84,8 +84,8 @@ private function processDefinition(ContainerBuilder $container, $id, Definition
8484
$instanceofCalls[] = $methodCall;
8585
}
8686

87-
$instanceofDef->setTags(array());
88-
$instanceofDef->setMethodCalls(array());
87+
$instanceofDef->setTags([]);
88+
$instanceofDef->setMethodCalls([]);
8989

9090
if (isset($instanceofDef->getChanges()['shared'])) {
9191
$shared = $instanceofDef->isShared();
@@ -98,7 +98,7 @@ private function processDefinition(ContainerBuilder $container, $id, Definition
9898
$abstract = $container->setDefinition('.abstract.instanceof.'.$id, $definition);
9999

100100
// cast Definition to ChildDefinition
101-
$definition->setBindings(array());
101+
$definition->setBindings([]);
102102
$definition = serialize($definition);
103103
$definition = substr_replace($definition, '53', 2, 2);
104104
$definition = substr_replace($definition, 'Child', 44, 0);
@@ -127,11 +127,11 @@ private function processDefinition(ContainerBuilder $container, $id, Definition
127127

128128
// reset fields with "merge" behavior
129129
$abstract
130-
->setBindings(array())
131-
->setArguments(array())
132-
->setMethodCalls(array())
130+
->setBindings([])
131+
->setArguments([])
132+
->setMethodCalls([])
133133
->setDecoratedService(null)
134-
->setTags(array())
134+
->setTags([])
135135
->setAbstract(true);
136136
}
137137

@@ -141,7 +141,7 @@ private function processDefinition(ContainerBuilder $container, $id, Definition
141141
private function mergeConditionals(array $autoconfiguredInstanceof, array $instanceofConditionals, ContainerBuilder $container)
142142
{
143143
// make each value an array of ChildDefinition
144-
$conditionals = array_map(function ($childDef) { return array($childDef); }, $autoconfiguredInstanceof);
144+
$conditionals = array_map(function ($childDef) { return [$childDef]; }, $autoconfiguredInstanceof);
145145

146146
foreach ($instanceofConditionals as $interface => $instanceofDef) {
147147
// make sure the interface/class exists (but don't validate automaticInstanceofConditionals)
@@ -150,7 +150,7 @@ private function mergeConditionals(array $autoconfiguredInstanceof, array $insta
150150
}
151151

152152
if (!isset($autoconfiguredInstanceof[$interface])) {
153-
$conditionals[$interface] = array();
153+
$conditionals[$interface] = [];
154154
}
155155

156156
$conditionals[$interface][] = $instanceofDef;

Compiler/ValidateEnvPlaceholdersPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
class ValidateEnvPlaceholdersPass implements CompilerPassInterface
2828
{
29-
private static $typeFixtures = array('array' => array(), 'bool' => false, 'float' => 0.0, 'int' => 0, 'string' => '');
29+
private static $typeFixtures = ['array' => [], 'bool' => false, 'float' => 0.0, 'int' => 0, 'string' => ''];
3030

3131
/**
3232
* {@inheritdoc}
@@ -46,14 +46,14 @@ public function process(ContainerBuilder $container)
4646
$envTypes = $resolvingBag->getProvidedTypes();
4747
try {
4848
foreach ($resolvingBag->getEnvPlaceholders() + $resolvingBag->getUnusedEnvPlaceholders() as $env => $placeholders) {
49-
$values = array();
49+
$values = [];
5050
if (false === $i = strpos($env, ':')) {
5151
$default = $defaultBag->has("env($env)") ? $defaultBag->get("env($env)") : self::$typeFixtures['string'];
5252
$defaultType = null !== $default ? self::getType($default) : 'string';
5353
$values[$defaultType] = $default;
5454
} else {
5555
$prefix = substr($env, 0, $i);
56-
foreach ($envTypes[$prefix] ?? array('string') as $type) {
56+
foreach ($envTypes[$prefix] ?? ['string'] as $type) {
5757
$values[$type] = self::$typeFixtures[$type] ?? null;
5858
}
5959
}

0 commit comments

Comments
 (0)