Skip to content

Commit 700aa78

Browse files
committed
fixed CS
1 parent 7624b2a commit 700aa78

File tree

6 files changed

+84
-84
lines changed

6 files changed

+84
-84
lines changed

Dumper/PhpDumper.php

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class PhpDumper extends Dumper
6262
private $variableCount;
6363
private $inlinedDefinitions;
6464
private $serviceCalls;
65-
private $reservedVariables = array('instance', 'class', 'this');
65+
private $reservedVariables = ['instance', 'class', 'this'];
6666
private $expressionLanguage;
6767
private $targetDirRegex;
6868
private $targetDirMaxMatches;
@@ -73,14 +73,14 @@ class PhpDumper extends Dumper
7373
private $asFiles;
7474
private $hotPathTag;
7575
private $inlineRequires;
76-
private $inlinedRequires = array();
77-
private $circularReferences = array();
78-
private $singleUsePrivateIds = array();
76+
private $inlinedRequires = [];
77+
private $circularReferences = [];
78+
private $singleUsePrivateIds = [];
7979
private $addThrow = false;
8080
private $addGetService = false;
81-
private $locatedIds = array();
81+
private $locatedIds = [];
8282
private $serviceLocatorTag;
83-
private $exportedVariables = array();
83+
private $exportedVariables = [];
8484

8585
/**
8686
* @var ProxyDumper
@@ -121,13 +121,13 @@ public function setProxyDumper(ProxyDumper $proxyDumper)
121121
*
122122
* @throws EnvParameterException When an env var exists but has not been dumped
123123
*/
124-
public function dump(array $options = array())
124+
public function dump(array $options = [])
125125
{
126-
$this->locatedIds = array();
126+
$this->locatedIds = [];
127127
$this->targetDirRegex = null;
128-
$this->inlinedRequires = array();
129-
$this->exportedVariables = array();
130-
$options = array_merge(array(
128+
$this->inlinedRequires = [];
129+
$this->exportedVariables = [];
130+
$options = array_merge([
131131
'class' => 'ProjectServiceContainer',
132132
'base_class' => 'Container',
133133
'namespace' => '',
@@ -137,7 +137,7 @@ public function dump(array $options = array())
137137
'inline_class_loader_parameter' => 'container.dumper.inline_class_loader',
138138
'service_locator_tag' => 'container.service_locator',
139139
'build_time' => time(),
140-
), $options);
140+
], $options);
141141

142142
$this->addThrow = $this->addGetService = false;
143143
$this->namespace = $options['namespace'];
@@ -171,9 +171,9 @@ public function dump(array $options = array())
171171
}
172172

173173
(new AnalyzeServiceReferencesPass(false, !$this->getProxyDumper() instanceof NullDumper))->process($this->container);
174-
$checkedNodes = array();
175-
$this->circularReferences = array();
176-
$this->singleUsePrivateIds = array();
174+
$checkedNodes = [];
175+
$this->circularReferences = [];
176+
$this->singleUsePrivateIds = [];
177177
foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) {
178178
if (!$node->getValue() instanceof Definition) {
179179
continue;
@@ -186,7 +186,7 @@ public function dump(array $options = array())
186186
}
187187
}
188188
$this->container->getCompiler()->getServiceReferenceGraph()->clear();
189-
$checkedNodes = array();
189+
$checkedNodes = [];
190190

191191
$this->docStar = $options['debug'] ? '*' : '';
192192

@@ -240,7 +240,7 @@ public function dump(array $options = array())
240240
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
241241
242242
EOF;
243-
$files = array();
243+
$files = [];
244244

245245
$ids = $this->container->getRemovedIds();
246246
foreach ($this->container->getDefinitions() as $id => $definition) {
@@ -265,7 +265,7 @@ public function dump(array $options = array())
265265
}
266266
$files[$options['class'].'.php'] = $code.$this->endClass();
267267
$hash = ucfirst(strtr(ContainerBuilder::hash($files), '._', 'xx'));
268-
$code = array();
268+
$code = [];
269269

270270
foreach ($files as $file => $c) {
271271
$code["Container{$hash}/{$file}"] = $c;
@@ -308,12 +308,12 @@ public function dump(array $options = array())
308308
}
309309

310310
$this->targetDirRegex = null;
311-
$this->inlinedRequires = array();
312-
$this->circularReferences = array();
313-
$this->locatedIds = array();
314-
$this->exportedVariables = array();
311+
$this->inlinedRequires = [];
312+
$this->circularReferences = [];
313+
$this->locatedIds = [];
314+
$this->exportedVariables = [];
315315

316-
$unusedEnvs = array();
316+
$unusedEnvs = [];
317317
foreach ($this->container->getEnvCounters() as $env => $use) {
318318
if (!$use) {
319319
$unusedEnvs[] = $env;
@@ -338,7 +338,7 @@ private function getProxyDumper(): ProxyDumper
338338
return $this->proxyDumper;
339339
}
340340

341-
private function analyzeCircularReferences($sourceId, array $edges, &$checkedNodes, &$currentPath = array())
341+
private function analyzeCircularReferences($sourceId, array $edges, &$checkedNodes, &$currentPath = [])
342342
{
343343
$checkedNodes[$sourceId] = true;
344344
$currentPath[$sourceId] = $sourceId;
@@ -367,7 +367,7 @@ private function analyzeCircularReferences($sourceId, array $edges, &$checkedNod
367367
unset($currentPath[$sourceId]);
368368
}
369369

370-
private function connectCircularReferences($sourceId, &$currentPath, &$subPath = array())
370+
private function connectCircularReferences($sourceId, &$currentPath, &$subPath = [])
371371
{
372372
$subPath[$sourceId] = $sourceId;
373373
$currentPath[$sourceId] = $sourceId;
@@ -423,7 +423,7 @@ private function collectLineage($class, array &$lineage)
423423

424424
private function generateProxyClasses()
425425
{
426-
$alreadyGenerated = array();
426+
$alreadyGenerated = [];
427427
$definitions = $this->container->getDefinitions();
428428
$strip = '' === $this->docStar && method_exists('Symfony\Component\HttpKernel\Kernel', 'stripComments');
429429
$proxyDumper = $this->getProxyDumper();
@@ -454,7 +454,7 @@ private function addServiceInclude(string $cId, Definition $definition): string
454454
$code = '';
455455

456456
if ($this->inlineRequires && !$this->isHotPath($definition)) {
457-
$lineage = array();
457+
$lineage = [];
458458
foreach ($this->inlinedDefinitions as $def) {
459459
if (!$def->isDeprecated() && \is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) {
460460
$this->collectLineage($class, $lineage);
@@ -566,7 +566,7 @@ private function addServiceMethodCalls(Definition $definition, string $variableN
566566
{
567567
$calls = '';
568568
foreach ($definition->getMethodCalls() as $call) {
569-
$arguments = array();
569+
$arguments = [];
570570
foreach ($call[1] as $value) {
571571
$arguments[] = $this->dumpValue($value);
572572
}
@@ -619,11 +619,11 @@ private function addServiceConfigurator(Definition $definition, string $variable
619619
private function addService(string $id, Definition $definition): array
620620
{
621621
$this->definitionVariables = new \SplObjectStorage();
622-
$this->referenceVariables = array();
622+
$this->referenceVariables = [];
623623
$this->variableCount = 0;
624624
$this->referenceVariables[$id] = new Variable('instance');
625625

626-
$return = array();
626+
$return = [];
627627

628628
if ($class = $definition->getClass()) {
629629
$class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class);
@@ -680,8 +680,8 @@ protected function {$methodName}($lazyInitialization)
680680
EOF;
681681
}
682682

683-
$this->serviceCalls = array();
684-
$this->inlinedDefinitions = $this->getDefinitionsFromArguments(array($definition), null, $this->serviceCalls);
683+
$this->serviceCalls = [];
684+
$this->inlinedDefinitions = $this->getDefinitionsFromArguments([$definition], null, $this->serviceCalls);
685685

686686
$code .= $this->addServiceInclude($id, $definition);
687687

@@ -705,7 +705,7 @@ protected function {$methodName}($lazyInitialization)
705705
$this->definitionVariables = $this->inlinedDefinitions = null;
706706
$this->referenceVariables = $this->serviceCalls = null;
707707

708-
return array($file, $code);
708+
return [$file, $code];
709709
}
710710

711711
private function addInlineVariables(string $id, Definition $definition, array $arguments, bool $forConstructor): string
@@ -782,11 +782,11 @@ private function addInlineService(string $id, Definition $definition, Definition
782782
return '';
783783
}
784784

785-
$arguments = array($inlineDef->getArguments(), $inlineDef->getFactory());
785+
$arguments = [$inlineDef->getArguments(), $inlineDef->getFactory()];
786786

787787
$code = $this->addInlineVariables($id, $definition, $arguments, $forConstructor);
788788

789-
if ($arguments = array_filter(array($inlineDef->getProperties(), $inlineDef->getMethodCalls(), $inlineDef->getConfigurator()))) {
789+
if ($arguments = array_filter([$inlineDef->getProperties(), $inlineDef->getMethodCalls(), $inlineDef->getConfigurator()])) {
790790
$isSimpleInstance = false;
791791
} elseif ($definition !== $inlineDef && 2 > $this->inlinedDefinitions[$inlineDef]) {
792792
return $code;
@@ -855,9 +855,9 @@ private function generateServiceFiles(array $services)
855855
if (!$definition->isShared()) {
856856
$i = strpos($code, "\n\ninclude_once ");
857857
if (false !== $i && false !== $i = strpos($code, "\n\n", 2 + $i)) {
858-
$code = array(substr($code, 0, 2 + $i), substr($code, 2 + $i));
858+
$code = [substr($code, 0, 2 + $i), substr($code, 2 + $i)];
859859
} else {
860-
$code = array("\n", $code);
860+
$code = ["\n", $code];
861861
}
862862
$code[1] = implode("\n", array_map(function ($line) { return $line ? ' '.$line : $line; }, explode("\n", $code[1])));
863863
$factory = sprintf('$this->factories%s[\'%s\']', $definition->isPublic() ? '' : "['service_container']", $id);
@@ -875,15 +875,15 @@ private function addNewInstance(Definition $definition, string $return = '', str
875875
$tail = $return ? ";\n" : '';
876876

877877
if (BaseServiceLocator::class === $definition->getClass() && $definition->hasTag($this->serviceLocatorTag)) {
878-
$arguments = array();
878+
$arguments = [];
879879
foreach ($definition->getArgument(0) as $k => $argument) {
880880
$arguments[$k] = $argument->getValues()[0];
881881
}
882882

883883
return $return.$this->dumpValue(new ServiceLocatorArgument($arguments)).$tail;
884884
}
885885

886-
$arguments = array();
886+
$arguments = [];
887887
foreach ($definition->getArguments() as $value) {
888888
$arguments[] = $this->dumpValue($value);
889889
}
@@ -1157,11 +1157,11 @@ private function addInlineRequires(): string
11571157
return '';
11581158
}
11591159

1160-
$lineage = array();
1160+
$lineage = [];
11611161

11621162
foreach ($this->container->findTaggedServiceIds($this->hotPathTag) as $id => $tags) {
11631163
$definition = $this->container->getDefinition($id);
1164-
$inlinedDefinitions = $this->getDefinitionsFromArguments(array($definition));
1164+
$inlinedDefinitions = $this->getDefinitionsFromArguments([$definition]);
11651165

11661166
foreach ($inlinedDefinitions as $def) {
11671167
if (\is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) {
@@ -1188,14 +1188,14 @@ private function addDefaultParametersMethod(): string
11881188
return '';
11891189
}
11901190

1191-
$php = array();
1192-
$dynamicPhp = array();
1191+
$php = [];
1192+
$dynamicPhp = [];
11931193

11941194
foreach ($this->container->getParameterBag()->all() as $key => $value) {
11951195
if ($key !== $resolvedKey = $this->container->resolveEnvPlaceholders($key)) {
11961196
throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: %s.', $resolvedKey));
11971197
}
1198-
$export = $this->exportParameters(array($value));
1198+
$export = $this->exportParameters([$value]);
11991199
$export = explode('0 => ', substr(rtrim($export, " )\n"), 7, -1), 2);
12001200

12011201
if (preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDirs\[\d++\])/", $export[1])) {
@@ -1317,7 +1317,7 @@ protected function getDefaultParameters()
13171317
*/
13181318
private function exportParameters(array $parameters, string $path = '', int $indent = 12): string
13191319
{
1320-
$php = array();
1320+
$php = [];
13211321
foreach ($parameters as $key => $value) {
13221322
if (\is_array($value)) {
13231323
$value = $this->exportParameters($value, $path.'/'.$key, $indent + 4);
@@ -1375,7 +1375,7 @@ private function wrapServiceConditionals($value, string $code): string
13751375

13761376
private function getServiceConditionals($value): string
13771377
{
1378-
$conditions = array();
1378+
$conditions = [];
13791379
foreach (ContainerBuilder::getInitializedConditionals($value) as $service) {
13801380
if (!$this->container->hasDefinition($service)) {
13811381
return 'false';
@@ -1397,7 +1397,7 @@ private function getServiceConditionals($value): string
13971397
return implode(' && ', $conditions);
13981398
}
13991399

1400-
private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = array()): \SplObjectStorage
1400+
private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = []): \SplObjectStorage
14011401
{
14021402
if (null === $definitions) {
14031403
$definitions = new \SplObjectStorage();
@@ -1410,7 +1410,7 @@ private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage
14101410
$id = (string) $argument;
14111411

14121412
if (!isset($calls[$id])) {
1413-
$calls[$id] = array(0, $argument->getInvalidBehavior());
1413+
$calls[$id] = [0, $argument->getInvalidBehavior()];
14141414
} else {
14151415
$calls[$id][1] = min($calls[$id][1], $argument->getInvalidBehavior());
14161416
}
@@ -1422,7 +1422,7 @@ private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage
14221422
$definitions[$argument] = 1 + $definitions[$argument];
14231423
} else {
14241424
$definitions[$argument] = 1;
1425-
$arguments = array($argument->getArguments(), $argument->getFactory(), $argument->getProperties(), $argument->getMethodCalls(), $argument->getConfigurator());
1425+
$arguments = [$argument->getArguments(), $argument->getFactory(), $argument->getProperties(), $argument->getMethodCalls(), $argument->getConfigurator()];
14261426
$this->getDefinitionsFromArguments($arguments, $definitions, $calls);
14271427
}
14281428
}
@@ -1439,14 +1439,14 @@ private function dumpValue($value, bool $interpolate = true): string
14391439
if ($value && $interpolate && false !== $param = array_search($value, $this->container->getParameterBag()->all(), true)) {
14401440
return $this->dumpValue("%$param%");
14411441
}
1442-
$code = array();
1442+
$code = [];
14431443
foreach ($value as $k => $v) {
14441444
$code[] = sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate));
14451445
}
14461446

14471447
return sprintf('array(%s)', implode(', ', $code));
14481448
} elseif ($value instanceof ArgumentInterface) {
1449-
$scope = array($this->definitionVariables, $this->referenceVariables);
1449+
$scope = [$this->definitionVariables, $this->referenceVariables];
14501450
$this->definitionVariables = $this->referenceVariables = null;
14511451

14521452
try {
@@ -1465,14 +1465,14 @@ private function dumpValue($value, bool $interpolate = true): string
14651465
}
14661466

14671467
if ($value instanceof IteratorArgument) {
1468-
$operands = array(0);
1469-
$code = array();
1468+
$operands = [0];
1469+
$code = [];
14701470
$code[] = 'new RewindableGenerator(function () {';
14711471

14721472
if (!$values = $value->getValues()) {
14731473
$code[] = ' return new \EmptyIterator();';
14741474
} else {
1475-
$countCode = array();
1475+
$countCode = [];
14761476
$countCode[] = 'function () {';
14771477

14781478
foreach ($values as $k => $v) {
@@ -1548,7 +1548,7 @@ private function dumpValue($value, bool $interpolate = true): string
15481548

15491549
return $this->getServiceCall($id, $value);
15501550
} elseif ($value instanceof Expression) {
1551-
return $this->getExpressionLanguage()->compile((string) $value, array('this' => 'container'));
1551+
return $this->getExpressionLanguage()->compile((string) $value, ['this' => 'container']);
15521552
} elseif ($value instanceof Parameter) {
15531553
return $this->dumpParameter($value);
15541554
} elseif (true === $interpolate && \is_string($value)) {
@@ -1670,8 +1670,8 @@ private function getServiceCall(string $id, Reference $reference = null): string
16701670
*/
16711671
private function initializeMethodNamesMap(string $class)
16721672
{
1673-
$this->serviceIdToMethodNameMap = array();
1674-
$this->usedMethodNames = array();
1673+
$this->serviceIdToMethodNameMap = [];
1674+
$this->usedMethodNames = [];
16751675

16761676
if ($reflectionClass = $this->container->getReflectionClass($class)) {
16771677
foreach ($reflectionClass->getMethods() as $method) {
@@ -1776,7 +1776,7 @@ private function isSingleUsePrivateNode(ServiceReferenceGraphNode $node): bool
17761776
if ($node->getValue()->isPublic()) {
17771777
return false;
17781778
}
1779-
$ids = array();
1779+
$ids = [];
17801780
foreach ($node->getInEdges() as $edge) {
17811781
if (!$value = $edge->getSourceNode()->getValue()) {
17821782
continue;

EnvVarProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(ContainerInterface $container)
3131
*/
3232
public static function getProvidedTypes()
3333
{
34-
return array(
34+
return [
3535
'base64' => 'string',
3636
'bool' => 'bool',
3737
'const' => 'bool|int|float|string|array',
@@ -45,7 +45,7 @@ public static function getProvidedTypes()
4545
'default' => 'bool|int|float|string|array',
4646
'string' => 'string',
4747
'trim' => 'string',
48-
);
48+
];
4949
}
5050

5151
/**

0 commit comments

Comments
 (0)