Skip to content

Commit

Permalink
Merge branch '3.4' into 4.1
Browse files Browse the repository at this point in the history
* 3.4:
  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 []
  • Loading branch information
fabpot committed Jan 16, 2019
2 parents 2068060 + 8f54459 commit 1b7a2a3
Show file tree
Hide file tree
Showing 91 changed files with 562 additions and 562 deletions.
2 changes: 1 addition & 1 deletion Argument/BoundArgument.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct($value)
*/
public function getValues()
{
return array($this->value, $this->identifier, $this->used);
return [$this->value, $this->identifier, $this->used];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Argument/ServiceClosureArgument.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ServiceClosureArgument implements ArgumentInterface

public function __construct(Reference $reference)
{
$this->values = array($reference);
$this->values = [$reference];
}

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

Expand Down
2 changes: 1 addition & 1 deletion Argument/TaggedIteratorArgument.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TaggedIteratorArgument extends IteratorArgument

public function __construct(string $tag)
{
parent::__construct(array());
parent::__construct([]);

$this->tag = $tag;
}
Expand Down
2 changes: 1 addition & 1 deletion Compiler/AnalyzeServiceReferencesPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function processValue($value, $isRoot = false)
return $value;
}
if ($value instanceof Expression) {
$this->getExpressionLanguage()->compile((string) $value, array('this' => 'container'));
$this->getExpressionLanguage()->compile((string) $value, ['this' => 'container']);

return $value;
}
Expand Down
2 changes: 1 addition & 1 deletion Compiler/AutowireRequiredMethodsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function processValue($value, $isRoot = false)
return $value;
}

$alreadyCalledMethods = array();
$alreadyCalledMethods = [];

foreach ($value->getMethodCalls() as list($method)) {
$alreadyCalledMethods[strtolower($method)] = true;
Expand Down
4 changes: 2 additions & 2 deletions Compiler/CheckCircularReferencesPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function process(ContainerBuilder $container)
{
$graph = $container->getCompiler()->getServiceReferenceGraph();

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

$this->checkOutEdges($node->getOutEdges());
}
Expand Down
4 changes: 2 additions & 2 deletions Compiler/CheckDefinitionValidityPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function process(ContainerBuilder $container)
if ($definition->isPublic() && !$definition->isPrivate()) {
$resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs);
if (null !== $usedEnvs) {
throw new EnvParameterException(array($resolvedId), null, 'A service name ("%s") cannot contain dynamic values.');
throw new EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.');
}
}
}
Expand All @@ -92,7 +92,7 @@ public function process(ContainerBuilder $container)
if ($alias->isPublic() && !$alias->isPrivate()) {
$resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs);
if (null !== $usedEnvs) {
throw new EnvParameterException(array($resolvedId), null, 'An alias name ("%s") cannot contain dynamic values.');
throw new EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Compiler/MergeExtensionConfigurationPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function freezeAfterProcessing(Extension $extension, ContainerBuilder $co
// Extension::processConfiguration() wasn't called, we cannot know how configs were merged
return;
}
$this->processedEnvPlaceholders = array();
$this->processedEnvPlaceholders = [];

// serialize config and container to catch env vars nested in object graphs
$config = serialize($config).serialize($container->getDefinitions()).serialize($container->getAliases()).serialize($container->getParameterBag()->all());
Expand Down
2 changes: 1 addition & 1 deletion Compiler/PriorityTaggedServiceTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ trait PriorityTaggedServiceTrait
*/
private function findAndSortTaggedServices($tagName, ContainerBuilder $container)
{
$services = array();
$services = [];

foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) {
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
Expand Down
8 changes: 4 additions & 4 deletions Compiler/RegisterEnvVarProcessorsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
*/
class RegisterEnvVarProcessorsPass implements CompilerPassInterface
{
private static $allowedTypes = array('array', 'bool', 'float', 'int', 'string');
private static $allowedTypes = ['array', 'bool', 'float', 'int', 'string'];

public function process(ContainerBuilder $container)
{
$bag = $container->getParameterBag();
$types = array();
$processors = array();
$types = [];
$processors = [];
foreach ($container->findTaggedServiceIds('container.env_var_processor') as $id => $tags) {
if (!$r = $container->getReflectionClass($class = $container->getDefinition($id)->getClass())) {
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
Expand All @@ -58,7 +58,7 @@ public function process(ContainerBuilder $container)
if ($processors) {
$container->register('container.env_var_processors_locator', ServiceLocator::class)
->setPublic(true)
->setArguments(array($processors))
->setArguments([$processors])
;
}
}
Expand Down
6 changes: 3 additions & 3 deletions Compiler/RemoveUnusedDefinitionsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function process(ContainerBuilder $container)

if ($graph->hasNode($id)) {
$edges = $graph->getNode($id)->getInEdges();
$referencingAliases = array();
$sourceIds = array();
$referencingAliases = [];
$sourceIds = [];
foreach ($edges as $edge) {
if ($edge->isWeak()) {
continue;
Expand All @@ -60,7 +60,7 @@ public function process(ContainerBuilder $container)
}
$isReferenced = (\count(array_unique($sourceIds)) - \count($referencingAliases)) > 0;
} else {
$referencingAliases = array();
$referencingAliases = [];
$isReferenced = false;
}

Expand Down
6 changes: 3 additions & 3 deletions Compiler/ReplaceAliasByActualDefinitionPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ReplaceAliasByActualDefinitionPass extends AbstractRecursivePass
public function process(ContainerBuilder $container)
{
// First collect all alias targets that need to be replaced
$seenAliasTargets = array();
$replacements = array();
$seenAliasTargets = [];
$replacements = [];
foreach ($container->getAliases() as $definitionId => $target) {
$targetId = (string) $target;
// Special case: leave this target alone
Expand Down Expand Up @@ -69,7 +69,7 @@ public function process(ContainerBuilder $container)
$this->replacements = $replacements;

parent::process($container);
$this->replacements = array();
$this->replacements = [];
}

/**
Expand Down
16 changes: 8 additions & 8 deletions Compiler/ResolveBindingsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
*/
class ResolveBindingsPass extends AbstractRecursivePass
{
private $usedBindings = array();
private $unusedBindings = array();
private $errorMessages = array();
private $usedBindings = [];
private $unusedBindings = [];
private $errorMessages = [];

/**
* {@inheritdoc}
Expand All @@ -48,9 +48,9 @@ public function process(ContainerBuilder $container)
throw new InvalidArgumentException($message);
}
} finally {
$this->usedBindings = array();
$this->unusedBindings = array();
$this->errorMessages = array();
$this->usedBindings = [];
$this->unusedBindings = [];
$this->errorMessages = [];
}
}

Expand Down Expand Up @@ -80,7 +80,7 @@ protected function processValue($value, $isRoot = false)
$this->usedBindings[$bindingId] = true;
unset($this->unusedBindings[$bindingId]);
} elseif (!isset($this->usedBindings[$bindingId])) {
$this->unusedBindings[$bindingId] = array($key, $this->currentId);
$this->unusedBindings[$bindingId] = [$key, $this->currentId];
}

if (isset($key[0]) && '$' === $key[0]) {
Expand All @@ -100,7 +100,7 @@ protected function processValue($value, $isRoot = false)

try {
if ($constructor = $this->getConstructor($value, false)) {
$calls[] = array($constructor, $value->getArguments());
$calls[] = [$constructor, $value->getArguments()];
}
} catch (RuntimeException $e) {
$this->errorMessages[] = $e->getMessage();
Expand Down
2 changes: 1 addition & 1 deletion Compiler/ResolveChildDefinitionsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function processValue($value, $isRoot = false)
$value = $this->container->getDefinition($this->currentId);
}
if ($value instanceof ChildDefinition) {
$this->currentPath = array();
$this->currentPath = [];
$value = $this->resolveDefinition($value);
if ($isRoot) {
$this->container->setDefinition($this->currentId, $value);
Expand Down
4 changes: 2 additions & 2 deletions Compiler/ResolveHotPathPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class ResolveHotPathPass extends AbstractRecursivePass
{
private $tagName;
private $resolvedIds = array();
private $resolvedIds = [];

public function __construct($tagName = 'container.hot_path')
{
Expand All @@ -40,7 +40,7 @@ public function process(ContainerBuilder $container)
parent::process($container);
$container->getDefinition('service_container')->clearTag($this->tagName);
} finally {
$this->resolvedIds = array();
$this->resolvedIds = [];
}
}

Expand Down
4 changes: 2 additions & 2 deletions Compiler/ResolveNamedArgumentsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ protected function processValue($value, $isRoot = false)
}

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

foreach ($calls as $i => $call) {
list($method, $arguments) = $call;
$parameters = null;
$resolvedArguments = array();
$resolvedArguments = [];

foreach ($arguments as $key => $argument) {
if (\is_int($key)) {
Expand Down
2 changes: 1 addition & 1 deletion Compiler/ResolveParameterPlaceHoldersPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function process(ContainerBuilder $container)
try {
parent::process($container);

$aliases = array();
$aliases = [];
foreach ($container->getAliases() as $name => $target) {
$this->currentId = $name;
$aliases[$this->bag->resolveValue($name)] = $target;
Expand Down
4 changes: 2 additions & 2 deletions Compiler/ResolveReferencesToAliasesPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ protected function processValue($value, $isRoot = false)

private function getDefinitionId(string $id, ContainerBuilder $container): string
{
$seen = array();
$seen = [];
while ($container->hasAlias($id)) {
if (isset($seen[$id])) {
throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), array($id)));
throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), [$id]));
}
$seen[$id] = true;
$id = (string) $container->getAlias($id);
Expand Down
2 changes: 1 addition & 1 deletion Compiler/ServiceLocatorTagPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function register(ContainerBuilder $container, array $refMap, $cal
// to derivate customized instances from the prototype one.
$container->register($id .= '.'.$callerId, ServiceLocator::class)
->setPublic(false)
->setFactory(array(new Reference($locatorId), 'withContext'))
->setFactory([new Reference($locatorId), 'withContext'])
->addArgument($callerId)
->addArgument(new Reference('service_container'));
}
Expand Down
4 changes: 2 additions & 2 deletions Compiler/ServiceReferenceGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ServiceReferenceGraph
/**
* @var ServiceReferenceGraphNode[]
*/
private $nodes = array();
private $nodes = [];

public function hasNode(string $id): bool
{
Expand Down Expand Up @@ -67,7 +67,7 @@ public function clear()
foreach ($this->nodes as $node) {
$node->clear();
}
$this->nodes = array();
$this->nodes = [];
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Compiler/ServiceReferenceGraphNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
class ServiceReferenceGraphNode
{
private $id;
private $inEdges = array();
private $outEdges = array();
private $inEdges = [];
private $outEdges = [];
private $value;

/**
Expand Down Expand Up @@ -113,6 +113,6 @@ public function getValue()
*/
public function clear()
{
$this->inEdges = $this->outEdges = array();
$this->inEdges = $this->outEdges = [];
}
}
2 changes: 1 addition & 1 deletion Dumper/DumperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ interface DumperInterface
*
* @return string The representation of the service container
*/
public function dump(array $options = array());
public function dump(array $options = []);
}
Loading

0 comments on commit 1b7a2a3

Please sign in to comment.