Skip to content

Commit

Permalink
switched array() to []
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 16, 2019
1 parent 9150ac7 commit ea1c2fd
Show file tree
Hide file tree
Showing 119 changed files with 1,499 additions and 1,499 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 @@ -25,7 +25,7 @@ class TaggedIteratorArgument extends IteratorArgument
*/
public function __construct($tag)
{
parent::__construct(array());
parent::__construct([]);

$this->tag = (string) $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
30 changes: 15 additions & 15 deletions Compiler/AutowirePass.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
*/
class AutowirePass extends AbstractRecursivePass
{
private $definedTypes = array();
private $definedTypes = [];
private $types;
private $ambiguousServiceTypes;
private $autowired = array();
private $autowired = [];
private $lastFailure;
private $throwOnAutowiringException;
private $autowiringExceptions = array();
private $autowiringExceptions = [];
private $strictMode;

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

try {
parent::process($container);
} finally {
$this->definedTypes = array();
$this->definedTypes = [];
$this->types = null;
$this->ambiguousServiceTypes = null;
$this->autowired = array();
$this->autowired = [];
}
}

Expand All @@ -89,7 +89,7 @@ public static function createResourceForClass(\ReflectionClass $reflectionClass)
{
@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);

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

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

if ($constructor) {
array_unshift($methodCalls, array($constructor, $value->getArguments()));
array_unshift($methodCalls, [$constructor, $value->getArguments()]);
}

$methodCalls = $this->autowireCalls($reflectionClass, $methodCalls);
Expand Down Expand Up @@ -327,9 +327,9 @@ private function getAutowiredReference(TypedReference $reference, $deprecationMe
*/
private function populateAvailableTypes($onlyAutowiringTypes = false)
{
$this->types = array();
$this->types = [];
if (!$onlyAutowiringTypes) {
$this->ambiguousServiceTypes = array();
$this->ambiguousServiceTypes = [];
}

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

// keep an array of all services matching this type
if (!isset($this->ambiguousServiceTypes[$type])) {
$this->ambiguousServiceTypes[$type] = array($this->types[$type]);
$this->ambiguousServiceTypes[$type] = [$this->types[$type]];
unset($this->types[$type]);
}
$this->ambiguousServiceTypes[$type][] = $id;
Expand Down Expand Up @@ -521,7 +521,7 @@ private function createTypeAlternatives(TypedReference $reference)
*/
private static function getResourceMetadataForMethod(\ReflectionMethod $method)
{
$methodArgumentsMetadata = array();
$methodArgumentsMetadata = [];
foreach ($method->getParameters() as $parameter) {
try {
$class = $parameter->getClass();
Expand All @@ -531,19 +531,19 @@ private static function getResourceMetadataForMethod(\ReflectionMethod $method)
}

$isVariadic = method_exists($parameter, 'isVariadic') && $parameter->isVariadic();
$methodArgumentsMetadata[] = array(
$methodArgumentsMetadata[] = [
'class' => $class,
'isOptional' => $parameter->isOptional(),
'defaultValue' => ($parameter->isOptional() && !$isVariadic) ? $parameter->getDefaultValue() : null,
);
];
}

return $methodArgumentsMetadata;
}

private function getAliasesSuggestionForType($type, $extraContext = null)
{
$aliases = array();
$aliases = [];
foreach (class_parents($type) + class_implements($type) as $parent) {
if ($this->container->has($parent) && !$this->container->findDefinition($parent)->isAbstract()) {
$aliases[] = $parent;
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
4 changes: 2 additions & 2 deletions Compiler/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class Compiler
{
private $passConfig;
private $log = array();
private $log = [];
private $loggingFormatter;
private $serviceReferenceGraph;

Expand Down Expand Up @@ -141,7 +141,7 @@ public function compile(ContainerBuilder $container)
$pass->process($container);
}
} catch (\Exception $e) {
$usedEnvs = array();
$usedEnvs = [];
$prev = $e;

do {
Expand Down
8 changes: 4 additions & 4 deletions Compiler/DecoratorServicePass.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function process(ContainerBuilder $container)
if (!$decorated = $definition->getDecoratedService()) {
continue;
}
$definitions->insert(array($id, $definition), array($decorated[2], --$order));
$definitions->insert([$id, $definition], [$decorated[2], --$order]);
}
$decoratingDefinitions = array();
$decoratingDefinitions = [];

foreach ($definitions as list($id, $definition)) {
list($inner, $renamedId) = $definition->getDecoratedService();
Expand Down Expand Up @@ -68,9 +68,9 @@ public function process(ContainerBuilder $container)
if ($types = array_merge($autowiringTypes, $definition->getAutowiringTypes(false))) {
$definition->setAutowiringTypes($types);
}
$decoratingDefinition->setTags(array());
$decoratingDefinition->setTags([]);
if ($autowiringTypes) {
$decoratingDefinition->setAutowiringTypes(array());
$decoratingDefinition->setAutowiringTypes([]);
}
$decoratingDefinitions[$inner] = $definition;
}
Expand Down
4 changes: 2 additions & 2 deletions Compiler/FactoryReturnTypePass.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public function process(ContainerBuilder $container)
if (!method_exists(\ReflectionMethod::class, 'getReturnType')) {
return;
}
$resolveClassPassChanges = null !== $this->resolveClassPass ? $this->resolveClassPass->getChanges() : array();
$resolveClassPassChanges = null !== $this->resolveClassPass ? $this->resolveClassPass->getChanges() : [];

foreach ($container->getDefinitions() as $id => $definition) {
$this->updateDefinition($container, $id, $definition, $resolveClassPassChanges);
}
}

private function updateDefinition(ContainerBuilder $container, $id, Definition $definition, array $resolveClassPassChanges, array $previous = array())
private function updateDefinition(ContainerBuilder $container, $id, Definition $definition, array $resolveClassPassChanges, array $previous = [])
{
// circular reference
if (isset($previous[$id])) {
Expand Down
6 changes: 3 additions & 3 deletions Compiler/InlineServiceDefinitionsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*/
class InlineServiceDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface
{
private $cloningIds = array();
private $inlinedServiceIds = array();
private $cloningIds = [];
private $inlinedServiceIds = [];

/**
* {@inheritdoc}
Expand Down Expand Up @@ -126,7 +126,7 @@ private function isInlineableDefinition($id, Definition $definition, ServiceRefe
return false;
}

$ids = array();
$ids = [];
$isReferencedByConstructor = false;
foreach ($graph->getNode($id)->getInEdges() as $edge) {
$isReferencedByConstructor = $isReferencedByConstructor || $edge->isReferencedByConstructor();
Expand Down
2 changes: 1 addition & 1 deletion Compiler/MergeExtensionConfigurationPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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
Loading

0 comments on commit ea1c2fd

Please sign in to comment.