Skip to content

Commit 53a7ada

Browse files
committed
switched array() to []
1 parent 17c5d89 commit 53a7ada

Some content is hidden

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

55 files changed

+636
-636
lines changed

ConfigCache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public function __construct($file, $debug)
3535
{
3636
$this->debug = (bool) $debug;
3737

38-
$checkers = array();
38+
$checkers = [];
3939
if (true === $this->debug) {
40-
$checkers = array(new SelfCheckingResourceChecker());
40+
$checkers = [new SelfCheckingResourceChecker()];
4141
}
4242

4343
parent::__construct($file, $checkers);

Definition/ArrayNode.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
*/
2323
class ArrayNode extends BaseNode implements PrototypeNodeInterface
2424
{
25-
protected $xmlRemappings = array();
26-
protected $children = array();
25+
protected $xmlRemappings = [];
26+
protected $children = [];
2727
protected $allowFalse = false;
2828
protected $allowNewKeys = true;
2929
protected $addIfNotSet = false;
@@ -56,7 +56,7 @@ protected function preNormalize($value)
5656
return $value;
5757
}
5858

59-
$normalized = array();
59+
$normalized = [];
6060

6161
foreach ($value as $k => $v) {
6262
if (false !== strpos($k, '-') && false === strpos($k, '_') && !array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) {
@@ -177,7 +177,7 @@ public function getDefaultValue()
177177
throw new \RuntimeException(sprintf('The node at path "%s" has no default value.', $this->getPath()));
178178
}
179179

180-
$defaults = array();
180+
$defaults = [];
181181
foreach ($this->children as $name => $child) {
182182
if ($child->hasDefaultValue()) {
183183
$defaults[$name] = $child->getDefaultValue();
@@ -289,7 +289,7 @@ protected function normalizeValue($value)
289289

290290
$value = $this->remapXml($value);
291291

292-
$normalized = array();
292+
$normalized = [];
293293
foreach ($value as $name => $val) {
294294
if (isset($this->children[$name])) {
295295
try {

Definition/BaseNode.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ abstract class BaseNode implements NodeInterface
2525
{
2626
protected $name;
2727
protected $parent;
28-
protected $normalizationClosures = array();
29-
protected $finalValidationClosures = array();
28+
protected $normalizationClosures = [];
29+
protected $finalValidationClosures = [];
3030
protected $allowOverwrite = true;
3131
protected $required = false;
3232
protected $deprecationMessage = null;
33-
protected $equivalentValues = array();
34-
protected $attributes = array();
33+
protected $equivalentValues = [];
34+
protected $attributes = [];
3535

3636
/**
3737
* @param string|null $name The name of the node
@@ -127,7 +127,7 @@ public function getExample()
127127
*/
128128
public function addEquivalentValue($originalValue, $equivalentValue)
129129
{
130-
$this->equivalentValues[] = array($originalValue, $equivalentValue);
130+
$this->equivalentValues[] = [$originalValue, $equivalentValue];
131131
}
132132

133133
/**
@@ -211,7 +211,7 @@ public function isDeprecated()
211211
*/
212212
public function getDeprecationMessage($node, $path)
213213
{
214-
return strtr($this->deprecationMessage, array('%node%' => $node, '%path%' => $path));
214+
return strtr($this->deprecationMessage, ['%node%' => $node, '%path%' => $path]);
215215
}
216216

217217
/**

Definition/Builder/ArrayNodeDefinition.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
2525
protected $performDeepMerging = true;
2626
protected $ignoreExtraKeys = false;
2727
protected $removeExtraKeys = true;
28-
protected $children = array();
28+
protected $children = [];
2929
protected $prototype;
3030
protected $atLeastOne = false;
3131
protected $allowNewKeys = true;
@@ -43,8 +43,8 @@ public function __construct($name, NodeParentInterface $parent = null)
4343
{
4444
parent::__construct($name, $parent);
4545

46-
$this->nullEquivalent = array();
47-
$this->trueEquivalent = array();
46+
$this->nullEquivalent = [];
47+
$this->trueEquivalent = [];
4848
}
4949

5050
/**
@@ -275,9 +275,9 @@ public function canBeEnabled()
275275
{
276276
$this
277277
->addDefaultsIfNotSet()
278-
->treatFalseLike(array('enabled' => false))
279-
->treatTrueLike(array('enabled' => true))
280-
->treatNullLike(array('enabled' => true))
278+
->treatFalseLike(['enabled' => false])
279+
->treatTrueLike(['enabled' => true])
280+
->treatNullLike(['enabled' => true])
281281
->beforeNormalization()
282282
->ifArray()
283283
->then(function ($v) {
@@ -305,9 +305,9 @@ public function canBeDisabled()
305305
{
306306
$this
307307
->addDefaultsIfNotSet()
308-
->treatFalseLike(array('enabled' => false))
309-
->treatTrueLike(array('enabled' => true))
310-
->treatNullLike(array('enabled' => true))
308+
->treatFalseLike(['enabled' => false])
309+
->treatTrueLike(['enabled' => true])
310+
->treatNullLike(['enabled' => true])
311311
->children()
312312
->booleanNode('enabled')
313313
->defaultTrue()

Definition/Builder/ExprBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function ifNotInArray(array $array)
144144
public function castToArray()
145145
{
146146
$this->ifPart = function ($v) { return !\is_array($v); };
147-
$this->thenPart = function ($v) { return array($v); };
147+
$this->thenPart = function ($v) { return [$v]; };
148148

149149
return $this;
150150
}
@@ -168,7 +168,7 @@ public function then(\Closure $closure)
168168
*/
169169
public function thenEmptyArray()
170170
{
171-
$this->thenPart = function ($v) { return array(); };
171+
$this->thenPart = function ($v) { return []; };
172172

173173
return $this;
174174
}

Definition/Builder/NodeBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ class NodeBuilder implements NodeParentInterface
2323

2424
public function __construct()
2525
{
26-
$this->nodeMapping = array(
26+
$this->nodeMapping = [
2727
'variable' => __NAMESPACE__.'\\VariableNodeDefinition',
2828
'scalar' => __NAMESPACE__.'\\ScalarNodeDefinition',
2929
'boolean' => __NAMESPACE__.'\\BooleanNodeDefinition',
3030
'integer' => __NAMESPACE__.'\\IntegerNodeDefinition',
3131
'float' => __NAMESPACE__.'\\FloatNodeDefinition',
3232
'array' => __NAMESPACE__.'\\ArrayNodeDefinition',
3333
'enum' => __NAMESPACE__.'\\EnumNodeDefinition',
34-
);
34+
];
3535
}
3636

3737
/**

Definition/Builder/NodeDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class NodeDefinition implements NodeParentInterface
3434
protected $trueEquivalent = true;
3535
protected $falseEquivalent = false;
3636
protected $parent;
37-
protected $attributes = array();
37+
protected $attributes = [];
3838

3939
/**
4040
* @param string|null $name The name of the node

Definition/Builder/NormalizationBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
class NormalizationBuilder
2020
{
2121
protected $node;
22-
public $before = array();
23-
public $remappings = array();
22+
public $before = [];
23+
public $remappings = [];
2424

2525
public function __construct(NodeDefinition $node)
2626
{
@@ -37,7 +37,7 @@ public function __construct(NodeDefinition $node)
3737
*/
3838
public function remap($key, $plural = null)
3939
{
40-
$this->remappings[] = array($key, null === $plural ? $key.'s' : $plural);
40+
$this->remappings[] = [$key, null === $plural ? $key.'s' : $plural];
4141

4242
return $this;
4343
}

Definition/Builder/ValidationBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class ValidationBuilder
2020
{
2121
protected $node;
22-
public $rules = array();
22+
public $rules = [];
2323

2424
public function __construct(NodeDefinition $node)
2525
{

Definition/Dumper/XmlReferenceDumper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name
6565
}
6666
$rootName = str_replace('_', '-', $rootName);
6767

68-
$rootAttributes = array();
69-
$rootAttributeComments = array();
70-
$rootChildren = array();
71-
$rootComments = array();
68+
$rootAttributes = [];
69+
$rootAttributeComments = [];
70+
$rootChildren = [];
71+
$rootComments = [];
7272

7373
if ($node instanceof ArrayNode) {
7474
$children = $node->getChildren();
@@ -98,7 +98,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name
9898

9999
if ($prototype instanceof PrototypedArrayNode) {
100100
$prototype->setName($key);
101-
$children = array($key => $prototype);
101+
$children = [$key => $prototype];
102102
} elseif ($prototype instanceof ArrayNode) {
103103
$children = $prototype->getChildren();
104104
} else {
@@ -140,7 +140,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name
140140
$value = '%%%%not_defined%%%%'; // use a string which isn't used in the normal world
141141

142142
// comments
143-
$comments = array();
143+
$comments = [];
144144
if ($info = $child->getInfo()) {
145145
$comments[] = $info;
146146
}

0 commit comments

Comments
 (0)