Skip to content

Commit 9e00d61

Browse files
committed
switched array() to []
1 parent 9798a1b commit 9e00d61

File tree

212 files changed

+5749
-5749
lines changed

Some content is hidden

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

212 files changed

+5749
-5749
lines changed

AbstractExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getTypeExtensions($name)
8686

8787
return isset($this->typeExtensions[$name])
8888
? $this->typeExtensions[$name]
89-
: array();
89+
: [];
9090
}
9191

9292
/**
@@ -120,7 +120,7 @@ public function getTypeGuesser()
120120
*/
121121
protected function loadTypes()
122122
{
123-
return array();
123+
return [];
124124
}
125125

126126
/**
@@ -130,7 +130,7 @@ protected function loadTypes()
130130
*/
131131
protected function loadTypeExtensions()
132132
{
133-
return array();
133+
return [];
134134
}
135135

136136
/**
@@ -149,7 +149,7 @@ protected function loadTypeGuesser()
149149
*/
150150
private function initTypes()
151151
{
152-
$this->types = array();
152+
$this->types = [];
153153

154154
foreach ($this->loadTypes() as $type) {
155155
if (!$type instanceof FormTypeInterface) {
@@ -168,7 +168,7 @@ private function initTypes()
168168
*/
169169
private function initTypeExtensions()
170170
{
171-
$this->typeExtensions = array();
171+
$this->typeExtensions = [];
172172

173173
foreach ($this->loadTypeExtensions() as $extension) {
174174
if (!$extension instanceof FormTypeExtensionInterface) {

AbstractRendererEngine.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface
2424
const CACHE_KEY_VAR = 'cache_key';
2525

2626
protected $defaultThemes;
27-
protected $themes = array();
28-
protected $useDefaultThemes = array();
29-
protected $resources = array();
27+
protected $themes = [];
28+
protected $useDefaultThemes = [];
29+
protected $resources = [];
3030

31-
private $resourceHierarchyLevels = array();
31+
private $resourceHierarchyLevels = [];
3232

3333
/**
3434
* Creates a new renderer engine.
3535
*
3636
* @param array $defaultThemes The default themes. The type of these
3737
* themes is open to the implementation.
3838
*/
39-
public function __construct(array $defaultThemes = array())
39+
public function __construct(array $defaultThemes = [])
4040
{
4141
$this->defaultThemes = $defaultThemes;
4242
}
@@ -49,7 +49,7 @@ public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */
4949
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
5050

5151
// Do not cast, as casting turns objects into arrays of properties
52-
$this->themes[$cacheKey] = \is_array($themes) ? $themes : array($themes);
52+
$this->themes[$cacheKey] = \is_array($themes) ? $themes : [$themes];
5353

5454
$args = \func_get_args();
5555
$this->useDefaultThemes[$cacheKey] = isset($args[2]) ? (bool) $args[2] : true;

Button.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function getParent()
132132
*
133133
* @throws BadMethodCallException
134134
*/
135-
public function add($child, $type = null, array $options = array())
135+
public function add($child, $type = null, array $options = [])
136136
{
137137
throw new BadMethodCallException('Buttons cannot have children.');
138138
}
@@ -182,15 +182,15 @@ public function remove($name)
182182
*/
183183
public function all()
184184
{
185-
return array();
185+
return [];
186186
}
187187

188188
/**
189189
* {@inheritdoc}
190190
*/
191191
public function getErrors($deep = false, $flatten = true)
192192
{
193-
return new FormErrorIterator($this, array());
193+
return new FormErrorIterator($this, []);
194194
}
195195

196196
/**
@@ -234,7 +234,7 @@ public function getViewData()
234234
*/
235235
public function getExtraData()
236236
{
237-
return array();
237+
return [];
238238
}
239239

240240
/**

ButtonBuilder.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
4545
/**
4646
* @var array
4747
*/
48-
private $attributes = array();
48+
private $attributes = [];
4949

5050
/**
5151
* @var array
@@ -60,7 +60,7 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
6060
*
6161
* @throws InvalidArgumentException if the name is empty
6262
*/
63-
public function __construct($name, array $options = array())
63+
public function __construct($name, array $options = [])
6464
{
6565
$name = (string) $name;
6666
if ('' === $name) {
@@ -82,7 +82,7 @@ public function __construct($name, array $options = array())
8282
*
8383
* @throws BadMethodCallException
8484
*/
85-
public function add($child, $type = null, array $options = array())
85+
public function add($child, $type = null, array $options = [])
8686
{
8787
throw new BadMethodCallException('Buttons cannot have children.');
8888
}
@@ -98,7 +98,7 @@ public function add($child, $type = null, array $options = array())
9898
*
9999
* @throws BadMethodCallException
100100
*/
101-
public function create($name, $type = null, array $options = array())
101+
public function create($name, $type = null, array $options = [])
102102
{
103103
throw new BadMethodCallException('Buttons cannot have children.');
104104
}
@@ -150,7 +150,7 @@ public function has($name)
150150
*/
151151
public function all()
152152
{
153-
return array();
153+
return [];
154154
}
155155

156156
/**
@@ -588,7 +588,7 @@ public function getType()
588588
*/
589589
public function getViewTransformers()
590590
{
591-
return array();
591+
return [];
592592
}
593593

594594
/**
@@ -598,7 +598,7 @@ public function getViewTransformers()
598598
*/
599599
public function getModelTransformers()
600600
{
601-
return array();
601+
return [];
602602
}
603603

604604
/**

ChoiceList/ArrayChoiceList.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function getOriginalKeys()
132132
*/
133133
public function getChoicesForValues(array $values)
134134
{
135-
$choices = array();
135+
$choices = [];
136136

137137
foreach ($values as $i => $givenValue) {
138138
if (array_key_exists($givenValue, $this->choices)) {
@@ -148,11 +148,11 @@ public function getChoicesForValues(array $values)
148148
*/
149149
public function getValuesForChoices(array $choices)
150150
{
151-
$values = array();
151+
$values = [];
152152

153153
// Use the value callback to compare choices by their values, if present
154154
if ($this->valueCallback) {
155-
$givenValues = array();
155+
$givenValues = [];
156156

157157
foreach ($choices as $i => $givenChoice) {
158158
$givenValues[$i] = (string) \call_user_func($this->valueCallback, $givenChoice);
@@ -190,9 +190,9 @@ public function getValuesForChoices(array $choices)
190190
protected function flatten(array $choices, $value, &$choicesByValues, &$keysByValues, &$structuredValues)
191191
{
192192
if (null === $choicesByValues) {
193-
$choicesByValues = array();
194-
$keysByValues = array();
195-
$structuredValues = array();
193+
$choicesByValues = [];
194+
$keysByValues = [];
195+
$structuredValues = [];
196196
}
197197

198198
foreach ($choices as $key => $choice) {
@@ -219,7 +219,7 @@ protected function flatten(array $choices, $value, &$choicesByValues, &$keysByVa
219219
* @return bool returns true if the choices can be cast to strings and
220220
* false otherwise
221221
*/
222-
private function castableToString(array $choices, array &$cache = array())
222+
private function castableToString(array $choices, array &$cache = [])
223223
{
224224
foreach ($choices as $choice) {
225225
if (\is_array($choice)) {

ChoiceList/Factory/CachingFactoryDecorator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ class CachingFactoryDecorator implements ChoiceListFactoryInterface
2727
/**
2828
* @var ChoiceListInterface[]
2929
*/
30-
private $lists = array();
30+
private $lists = [];
3131

3232
/**
3333
* @var ChoiceListView[]
3434
*/
35-
private $views = array();
35+
private $views = [];
3636

3737
/**
3838
* Generates a SHA-256 hash for the given value.
@@ -89,7 +89,7 @@ public function createListFromChoices($choices, $value = null)
8989
// The value is not validated on purpose. The decorated factory may
9090
// decide which values to accept and which not.
9191

92-
$hash = self::generateHash(array($choices, $value), 'fromChoices');
92+
$hash = self::generateHash([$choices, $value], 'fromChoices');
9393

9494
if (!isset($this->lists[$hash])) {
9595
$this->lists[$hash] = $this->decoratedFactory->createListFromChoices($choices, $value);
@@ -103,7 +103,7 @@ public function createListFromChoices($choices, $value = null)
103103
*/
104104
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null)
105105
{
106-
$hash = self::generateHash(array($loader, $value), 'fromLoader');
106+
$hash = self::generateHash([$loader, $value], 'fromLoader');
107107

108108
if (!isset($this->lists[$hash])) {
109109
$this->lists[$hash] = $this->decoratedFactory->createListFromLoader($loader, $value);
@@ -119,7 +119,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
119119
{
120120
// The input is not validated on purpose. This way, the decorated
121121
// factory may decide which input to accept and which not.
122-
$hash = self::generateHash(array($list, $preferredChoices, $label, $index, $groupBy, $attr));
122+
$hash = self::generateHash([$list, $preferredChoices, $label, $index, $groupBy, $attr]);
123123

124124
if (!isset($this->views[$hash])) {
125125
$this->views[$hash] = $this->decoratedFactory->createView(

ChoiceList/Factory/DefaultChoiceListFactory.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
4747
*/
4848
public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, $index = null, $groupBy = null, $attr = null)
4949
{
50-
$preferredViews = array();
51-
$otherViews = array();
50+
$preferredViews = [];
51+
$otherViews = [];
5252
$choices = $list->getChoices();
5353
$keys = $list->getOriginalKeys();
5454

@@ -137,7 +137,7 @@ private static function addChoiceView($choice, $value, $label, $keys, &$index, $
137137
$label,
138138
// The attributes may be a callable or a mapping from choice indices
139139
// to nested arrays
140-
\is_callable($attr) ? \call_user_func($attr, $choice, $key, $value) : (isset($attr[$key]) ? $attr[$key] : array())
140+
\is_callable($attr) ? \call_user_func($attr, $choice, $key, $value) : (isset($attr[$key]) ? $attr[$key] : [])
141141
);
142142

143143
// $isPreferred may be null if no choices are preferred
@@ -157,8 +157,8 @@ private static function addChoiceViewsGroupedBy($groupBy, $label, $choices, $key
157157

158158
// Add the contents of groups to new ChoiceGroupView instances
159159
if (\is_array($value)) {
160-
$preferredViewsForGroup = array();
161-
$otherViewsForGroup = array();
160+
$preferredViewsForGroup = [];
161+
$otherViewsForGroup = [];
162162

163163
self::addChoiceViewsGroupedBy(
164164
$value,

ChoiceList/Loader/CallbackChoiceLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function loadChoicesForValues(array $values, $value = null)
5656
{
5757
// Optimize
5858
if (empty($values)) {
59-
return array();
59+
return [];
6060
}
6161

6262
return $this->loadChoiceList($value)->getChoicesForValues($values);
@@ -69,7 +69,7 @@ public function loadValuesForChoices(array $choices, $value = null)
6969
{
7070
// Optimize
7171
if (empty($choices)) {
72-
return array();
72+
return [];
7373
}
7474

7575
return $this->loadChoiceList($value)->getValuesForChoices($choices);

ChoiceList/View/ChoiceGroupView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ChoiceGroupView implements \IteratorAggregate
2727
* @param string $label The label of the group
2828
* @param ChoiceGroupView[]|ChoiceView[] $choices the choice views in the group
2929
*/
30-
public function __construct($label, array $choices = array())
30+
public function __construct($label, array $choices = [])
3131
{
3232
$this->label = $label;
3333
$this->choices = $choices;

ChoiceList/View/ChoiceListView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ChoiceListView
3131
* @param ChoiceGroupView[]|ChoiceView[] $choices The choice views
3232
* @param ChoiceGroupView[]|ChoiceView[] $preferredChoices the preferred choice views
3333
*/
34-
public function __construct(array $choices = array(), array $preferredChoices = array())
34+
public function __construct(array $choices = [], array $preferredChoices = [])
3535
{
3636
$this->choices = $choices;
3737
$this->preferredChoices = $preferredChoices;

0 commit comments

Comments
 (0)