Skip to content

Commit 051c529

Browse files
committed
Merge branch '3.4' into 4.1
* 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 []
2 parents 1d77448 + 5646f5b commit 051c529

File tree

191 files changed

+5265
-5265
lines changed

Some content is hidden

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

191 files changed

+5265
-5265
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) {

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
/**

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) ($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/ChoiceListInterface.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ public function getValues();
4848
* keys of the choices. If the original array contained nested arrays, these
4949
* nested arrays are represented here as well:
5050
*
51-
* $form->add('field', 'choice', array(
52-
* 'choices' => array(
53-
* 'Decided' => array('Yes' => true, 'No' => false),
54-
* 'Undecided' => array('Maybe' => null),
55-
* ),
56-
* ));
51+
* $form->add('field', 'choice', [
52+
* 'choices' => [
53+
* 'Decided' => ['Yes' => true, 'No' => false],
54+
* 'Undecided' => ['Maybe' => null],
55+
* ],
56+
* ]);
5757
*
5858
* In this example, the result of this method is:
5959
*
60-
* array(
61-
* 'Decided' => array('Yes' => '0', 'No' => '1'),
62-
* 'Undecided' => array('Maybe' => '2'),
63-
* )
60+
* [
61+
* 'Decided' => ['Yes' => '0', 'No' => '1'],
62+
* 'Undecided' => ['Maybe' => '2'],
63+
* ]
6464
*
6565
* @return string[] The choice values
6666
*/
@@ -73,12 +73,12 @@ public function getStructuredValues();
7373
* "choice" option of the choice type. Note that this array may contain
7474
* duplicates if the "choice" option contained choice groups:
7575
*
76-
* $form->add('field', 'choice', array(
77-
* 'choices' => array(
78-
* 'Decided' => array(true, false),
79-
* 'Undecided' => array(null),
80-
* ),
81-
* ));
76+
* $form->add('field', 'choice', [
77+
* 'choices' => [
78+
* 'Decided' => [true, false],
79+
* 'Undecided' => [null],
80+
* ],
81+
* ]);
8282
*
8383
* In this example, the original key 0 appears twice, once for `true` and
8484
* once for `null`.

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/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;

Command/DebugCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DebugCommand extends Command
3838
private $extensions;
3939
private $guessers;
4040

41-
public function __construct(FormRegistryInterface $formRegistry, array $namespaces = array('Symfony\Component\Form\Extension\Core\Type'), array $types = array(), array $extensions = array(), array $guessers = array())
41+
public function __construct(FormRegistryInterface $formRegistry, array $namespaces = ['Symfony\Component\Form\Extension\Core\Type'], array $types = [], array $extensions = [], array $guessers = [])
4242
{
4343
parent::__construct();
4444

@@ -55,11 +55,11 @@ public function __construct(FormRegistryInterface $formRegistry, array $namespac
5555
protected function configure()
5656
{
5757
$this
58-
->setDefinition(array(
58+
->setDefinition([
5959
new InputArgument('class', InputArgument::OPTIONAL, 'The form type class'),
6060
new InputArgument('option', InputArgument::OPTIONAL, 'The form type option'),
6161
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt or json)', 'txt'),
62-
))
62+
])
6363
->setDescription('Displays form type information')
6464
->setHelp(<<<'EOF'
6565
The <info>%command.name%</info> command displays information about form types.
@@ -139,7 +139,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
139139

140140
private function getFqcnTypeClass(InputInterface $input, SymfonyStyle $io, $shortClassName)
141141
{
142-
$classes = array();
142+
$classes = [];
143143
sort($this->namespaces);
144144
foreach ($this->namespaces as $namespace) {
145145
if (class_exists($fqcn = $namespace.'\\'.$shortClassName)) {
@@ -186,7 +186,7 @@ private function getCoreTypes()
186186

187187
private function findAlternatives($name, array $collection)
188188
{
189-
$alternatives = array();
189+
$alternatives = [];
190190
foreach ($collection as $item) {
191191
$lev = levenshtein($name, $item);
192192
if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {

Console/Descriptor/Descriptor.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ abstract class Descriptor implements DescriptorInterface
3232
/** @var OutputStyle */
3333
protected $output;
3434
protected $type;
35-
protected $ownOptions = array();
36-
protected $overriddenOptions = array();
37-
protected $parentOptions = array();
38-
protected $extensionOptions = array();
39-
protected $requiredOptions = array();
40-
protected $parents = array();
41-
protected $extensions = array();
35+
protected $ownOptions = [];
36+
protected $overriddenOptions = [];
37+
protected $parentOptions = [];
38+
protected $extensionOptions = [];
39+
protected $requiredOptions = [];
40+
protected $parents = [];
41+
protected $extensions = [];
4242

4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function describe(OutputInterface $output, $object, array $options = array())
46+
public function describe(OutputInterface $output, $object, array $options = [])
4747
{
48-
$this->output = $output instanceof OutputStyle ? $output : new SymfonyStyle(new ArrayInput(array()), $output);
48+
$this->output = $output instanceof OutputStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output);
4949

5050
switch (true) {
5151
case null === $object:
@@ -64,14 +64,14 @@ public function describe(OutputInterface $output, $object, array $options = arra
6464

6565
abstract protected function describeDefaults(array $options);
6666

67-
abstract protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = array());
67+
abstract protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = []);
6868

6969
abstract protected function describeOption(OptionsResolver $optionsResolver, array $options);
7070

7171
protected function collectOptions(ResolvedFormTypeInterface $type)
7272
{
73-
$this->parents = array();
74-
$this->extensions = array();
73+
$this->parents = [];
74+
$this->extensions = [];
7575

7676
if (null !== $type->getParent()) {
7777
$optionsResolver = clone $this->getParentOptionsResolver($type->getParent());
@@ -83,15 +83,15 @@ protected function collectOptions(ResolvedFormTypeInterface $type)
8383
$this->ownOptions = array_diff($ownOptionsResolver->getDefinedOptions(), $optionsResolver->getDefinedOptions());
8484
$overriddenOptions = array_intersect(array_merge($ownOptionsResolver->getDefinedOptions(), $ownOptionsResolver->getUndefinedOptions()), $optionsResolver->getDefinedOptions());
8585

86-
$this->parentOptions = array();
86+
$this->parentOptions = [];
8787
foreach ($this->parents as $class => $parentOptions) {
8888
$this->overriddenOptions[$class] = array_intersect($overriddenOptions, $parentOptions);
8989
$this->parentOptions[$class] = array_diff($parentOptions, $overriddenOptions);
9090
}
9191

9292
$type->getInnerType()->configureOptions($optionsResolver);
9393
$this->collectTypeExtensionsOptions($type, $optionsResolver);
94-
$this->extensionOptions = array();
94+
$this->extensionOptions = [];
9595
foreach ($this->extensions as $class => $extensionOptions) {
9696
$this->overriddenOptions[$class] = array_intersect($overriddenOptions, $extensionOptions);
9797
$this->extensionOptions[$class] = array_diff($extensionOptions, $overriddenOptions);
@@ -108,17 +108,17 @@ protected function collectOptions(ResolvedFormTypeInterface $type)
108108

109109
protected function getOptionDefinition(OptionsResolver $optionsResolver, $option)
110110
{
111-
$definition = array('required' => $optionsResolver->isRequired($option));
111+
$definition = ['required' => $optionsResolver->isRequired($option)];
112112

113113
$introspector = new OptionsResolverIntrospector($optionsResolver);
114114

115-
$map = array(
115+
$map = [
116116
'default' => 'getDefault',
117117
'lazy' => 'getLazyClosures',
118118
'allowedTypes' => 'getAllowedTypes',
119119
'allowedValues' => 'getAllowedValues',
120120
'normalizer' => 'getNormalizer',
121-
);
121+
];
122122

123123
foreach ($map as $key => $method) {
124124
try {
@@ -133,7 +133,7 @@ protected function getOptionDefinition(OptionsResolver $optionsResolver, $option
133133

134134
private function getParentOptionsResolver(ResolvedFormTypeInterface $type)
135135
{
136-
$this->parents[$class = \get_class($type->getInnerType())] = array();
136+
$this->parents[$class = \get_class($type->getInnerType())] = [];
137137

138138
if (null !== $type->getParent()) {
139139
$optionsResolver = clone $this->getParentOptionsResolver($type->getParent());

0 commit comments

Comments
 (0)