Skip to content

Commit

Permalink
fixed CS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 16, 2019
1 parent 1b7a2a3 commit 2a898a2
Show file tree
Hide file tree
Showing 87 changed files with 1,414 additions and 1,414 deletions.
10 changes: 5 additions & 5 deletions Compiler/AutowirePass.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private function doProcessValue($value, $isRoot = false)
}

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

$this->methodCalls = $this->autowireCalls($reflectionClass, $isRoot);
Expand Down Expand Up @@ -291,8 +291,8 @@ private function getAutowiredReference(TypedReference $reference)
*/
private function populateAvailableTypes()
{
$this->types = array();
$this->ambiguousServiceTypes = array();
$this->types = [];
$this->ambiguousServiceTypes = [];

foreach ($this->container->getDefinitions() as $id => $definition) {
$this->populateAvailableType($id, $definition);
Expand Down Expand Up @@ -343,7 +343,7 @@ private function set(string $type, string $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 @@ -418,7 +418,7 @@ private function createTypeAlternatives(TypedReference $reference)

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
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 $serviceReferenceGraph;

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

do {
Expand Down
6 changes: 3 additions & 3 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 @@ -65,7 +65,7 @@ public function process(ContainerBuilder $container)
if (isset($decoratingDefinitions[$inner])) {
$decoratingDefinition = $decoratingDefinitions[$inner];
$definition->setTags(array_merge($decoratingDefinition->getTags(), $definition->getTags()));
$decoratingDefinition->setTags(array());
$decoratingDefinition->setTags([]);
$decoratingDefinitions[$inner] = $definition;
}

Expand Down
4 changes: 2 additions & 2 deletions Compiler/InlineServiceDefinitionsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class InlineServiceDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface
{
private $cloningIds = array();
private $cloningIds = [];

/**
* {@inheritdoc}
Expand Down Expand Up @@ -118,7 +118,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 @@ -144,7 +144,7 @@ public function getEnvPlaceholders()

public function getUnusedEnvPlaceholders(): array
{
return null === $this->processedEnvPlaceholders ? array() : array_diff_key(parent::getEnvPlaceholders(), $this->processedEnvPlaceholders);
return null === $this->processedEnvPlaceholders ? [] : array_diff_key(parent::getEnvPlaceholders(), $this->processedEnvPlaceholders);
}
}

Expand Down
52 changes: 26 additions & 26 deletions Compiler/PassConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ class PassConfig
const TYPE_REMOVE = 'removing';

private $mergePass;
private $afterRemovingPasses = array();
private $beforeOptimizationPasses = array();
private $beforeRemovingPasses = array();
private $afterRemovingPasses = [];
private $beforeOptimizationPasses = [];
private $beforeRemovingPasses = [];
private $optimizationPasses;
private $removingPasses;

public function __construct()
{
$this->mergePass = new MergeExtensionConfigurationPass();

$this->beforeOptimizationPasses = array(
100 => array(
$this->beforeOptimizationPasses = [
100 => [
new ResolveClassPass(),
new ResolveInstanceofConditionalsPass(),
new RegisterEnvVarProcessorsPass(),
),
-1000 => array(new ExtensionCompilerPass()),
);
],
-1000 => [new ExtensionCompilerPass()],
];

$this->optimizationPasses = array(array(
$this->optimizationPasses = [[
new ValidateEnvPlaceholdersPass(),
new ResolveChildDefinitionsPass(),
new ServiceLocatorTagPass(),
Expand All @@ -69,28 +69,28 @@ public function __construct()
new CheckCircularReferencesPass(),
new CheckReferenceValidityPass(),
new CheckArgumentsValidityPass(false),
));
]];

$this->beforeRemovingPasses = array(
-100 => array(
$this->beforeRemovingPasses = [
-100 => [
new ResolvePrivatesPass(),
),
);
],
];

$this->removingPasses = array(array(
$this->removingPasses = [[
new RemovePrivateAliasesPass(),
new ReplaceAliasByActualDefinitionPass(),
new RemoveAbstractDefinitionsPass(),
new RepeatedPass(array(
new RepeatedPass([
new AnalyzeServiceReferencesPass(),
new InlineServiceDefinitionsPass(),
new AnalyzeServiceReferencesPass(),
new RemoveUnusedDefinitionsPass(),
)),
]),
new DefinitionErrorExceptionPass(),
new CheckExceptionOnInvalidReferenceBehaviorPass(),
new ResolveHotPathPass(),
));
]];
}

/**
Expand All @@ -101,7 +101,7 @@ public function __construct()
public function getPasses()
{
return array_merge(
array($this->mergePass),
[$this->mergePass],
$this->getBeforeOptimizationPasses(),
$this->getOptimizationPasses(),
$this->getBeforeRemovingPasses(),
Expand Down Expand Up @@ -129,7 +129,7 @@ public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_O
$passes = &$this->$property;

if (!isset($passes[$priority])) {
$passes[$priority] = array();
$passes[$priority] = [];
}
$passes[$priority][] = $pass;
}
Expand Down Expand Up @@ -206,7 +206,7 @@ public function setMergePass(CompilerPassInterface $pass)
*/
public function setAfterRemovingPasses(array $passes)
{
$this->afterRemovingPasses = array($passes);
$this->afterRemovingPasses = [$passes];
}

/**
Expand All @@ -216,7 +216,7 @@ public function setAfterRemovingPasses(array $passes)
*/
public function setBeforeOptimizationPasses(array $passes)
{
$this->beforeOptimizationPasses = array($passes);
$this->beforeOptimizationPasses = [$passes];
}

/**
Expand All @@ -226,7 +226,7 @@ public function setBeforeOptimizationPasses(array $passes)
*/
public function setBeforeRemovingPasses(array $passes)
{
$this->beforeRemovingPasses = array($passes);
$this->beforeRemovingPasses = [$passes];
}

/**
Expand All @@ -236,7 +236,7 @@ public function setBeforeRemovingPasses(array $passes)
*/
public function setOptimizationPasses(array $passes)
{
$this->optimizationPasses = array($passes);
$this->optimizationPasses = [$passes];
}

/**
Expand All @@ -246,7 +246,7 @@ public function setOptimizationPasses(array $passes)
*/
public function setRemovingPasses(array $passes)
{
$this->removingPasses = array($passes);
$this->removingPasses = [$passes];
}

/**
Expand All @@ -259,7 +259,7 @@ public function setRemovingPasses(array $passes)
private function sortPasses(array $passes)
{
if (0 === \count($passes)) {
return array();
return [];
}

krsort($passes);
Expand Down
8 changes: 4 additions & 4 deletions Compiler/RegisterServiceSubscribersPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function processValue($value, $isRoot = false)
return parent::processValue($value, $isRoot);
}

$serviceMap = array();
$serviceMap = [];
$autowire = $value->isAutowired();

foreach ($value->getTag('container.service_subscriber') as $attributes) {
Expand All @@ -40,7 +40,7 @@ protected function processValue($value, $isRoot = false)
continue;
}
ksort($attributes);
if (array() !== array_diff(array_keys($attributes), array('id', 'key'))) {
if ([] !== array_diff(array_keys($attributes), ['id', 'key'])) {
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));
}
if (!array_key_exists('id', $attributes)) {
Expand All @@ -64,7 +64,7 @@ protected function processValue($value, $isRoot = false)
}
$class = $r->name;

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

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

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

return parent::processValue($value);
}
Expand Down
26 changes: 13 additions & 13 deletions Compiler/ResolveInstanceofConditionalsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function process(ContainerBuilder $container)
private function processDefinition(ContainerBuilder $container, $id, Definition $definition)
{
$instanceofConditionals = $definition->getInstanceofConditionals();
$autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : array();
$autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : [];
if (!$instanceofConditionals && !$autoconfiguredInstanceof) {
return $definition;
}
Expand All @@ -58,10 +58,10 @@ private function processDefinition(ContainerBuilder $container, $id, Definition

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

$definition->setInstanceofConditionals(array());
$definition->setInstanceofConditionals([]);
$parent = $shared = null;
$instanceofTags = array();
$instanceofCalls = array();
$instanceofTags = [];
$instanceofCalls = [];

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

$instanceofDef->setTags(array());
$instanceofDef->setMethodCalls(array());
$instanceofDef->setTags([]);
$instanceofDef->setMethodCalls([]);

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

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

// reset fields with "merge" behavior
$abstract
->setBindings(array())
->setArguments(array())
->setMethodCalls(array())
->setBindings([])
->setArguments([])
->setMethodCalls([])
->setDecoratedService(null)
->setTags(array())
->setTags([])
->setAbstract(true);
}

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

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

if (!isset($autoconfiguredInstanceof[$interface])) {
$conditionals[$interface] = array();
$conditionals[$interface] = [];
}

$conditionals[$interface][] = $instanceofDef;
Expand Down
6 changes: 3 additions & 3 deletions Compiler/ValidateEnvPlaceholdersPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class ValidateEnvPlaceholdersPass implements CompilerPassInterface
{
private static $typeFixtures = array('array' => array(), 'bool' => false, 'float' => 0.0, 'int' => 0, 'string' => '');
private static $typeFixtures = ['array' => [], 'bool' => false, 'float' => 0.0, 'int' => 0, 'string' => ''];

/**
* {@inheritdoc}
Expand All @@ -46,14 +46,14 @@ public function process(ContainerBuilder $container)
$envTypes = $resolvingBag->getProvidedTypes();
try {
foreach ($resolvingBag->getEnvPlaceholders() + $resolvingBag->getUnusedEnvPlaceholders() as $env => $placeholders) {
$values = array();
$values = [];
if (false === $i = strpos($env, ':')) {
$default = $defaultBag->has("env($env)") ? $defaultBag->get("env($env)") : self::$typeFixtures['string'];
$defaultType = null !== $default ? self::getType($default) : 'string';
$values[$defaultType] = $default;
} else {
$prefix = substr($env, 0, $i);
foreach ($envTypes[$prefix] ?? array('string') as $type) {
foreach ($envTypes[$prefix] ?? ['string'] as $type) {
$values[$type] = self::$typeFixtures[$type] ?? null;
}
}
Expand Down
Loading

0 comments on commit 2a898a2

Please sign in to comment.