Skip to content

Commit 4078ad3

Browse files
committed
fixed CS
1 parent 9f97ec0 commit 4078ad3

29 files changed

+273
-273
lines changed

AbstractExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ private function initTypeExtensions()
176176
}
177177

178178
if (method_exists($extension, 'getExtendedTypes')) {
179-
$extendedTypes = array();
179+
$extendedTypes = [];
180180

181181
foreach ($extension::getExtendedTypes() as $extendedType) {
182182
$extendedTypes[] = $extendedType;
183183
}
184184
} else {
185185
@trigger_error(sprintf('Not implementing the static getExtendedTypes() method in %s when implementing the %s is deprecated since Symfony 4.2. The method will be added to the interface in 5.0.', \get_class($extension), FormTypeExtensionInterface::class), E_USER_DEPRECATED);
186186

187-
$extendedTypes = array($extension->getExtendedType());
187+
$extendedTypes = [$extension->getExtendedType()];
188188
}
189189

190190
foreach ($extendedTypes as $extendedType) {

Command/DebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private function getCoreTypes()
200200

201201
private function filterTypesByDeprecated(array $types): array
202202
{
203-
$typesWithDeprecatedOptions = array();
203+
$typesWithDeprecatedOptions = [];
204204
foreach ($types as $class) {
205205
$optionsResolver = $this->formRegistry->getType($class)->getOptionsResolver();
206206
foreach ($optionsResolver->getDefinedOptions() as $option) {

Console/Descriptor/Descriptor.php

Lines changed: 21 additions & 21 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,21 +108,21 @@ protected function collectOptions(ResolvedFormTypeInterface $type)
108108

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

116116
$introspector = new OptionsResolverIntrospector($optionsResolver);
117117

118-
$map = array(
118+
$map = [
119119
'default' => 'getDefault',
120120
'lazy' => 'getLazyClosures',
121121
'allowedTypes' => 'getAllowedTypes',
122122
'allowedValues' => 'getAllowedValues',
123123
'normalizer' => 'getNormalizer',
124124
'deprecationMessage' => 'getDeprecationMessage',
125-
);
125+
];
126126

127127
foreach ($map as $key => $method) {
128128
try {
@@ -133,15 +133,15 @@ protected function getOptionDefinition(OptionsResolver $optionsResolver, $option
133133
}
134134

135135
if (isset($definition['deprecationMessage']) && \is_string($definition['deprecationMessage'])) {
136-
$definition['deprecationMessage'] = strtr($definition['deprecationMessage'], array('%name%' => $option));
136+
$definition['deprecationMessage'] = strtr($definition['deprecationMessage'], ['%name%' => $option]);
137137
}
138138

139139
return $definition;
140140
}
141141

142142
protected function filterOptionsByDeprecated(ResolvedFormTypeInterface $type)
143143
{
144-
$deprecatedOptions = array();
144+
$deprecatedOptions = [];
145145
$resolver = $type->getOptionsResolver();
146146
foreach ($resolver->getDefinedOptions() as $option) {
147147
if ($resolver->isDeprecated($option)) {
@@ -169,7 +169,7 @@ protected function filterOptionsByDeprecated(ResolvedFormTypeInterface $type)
169169

170170
private function getParentOptionsResolver(ResolvedFormTypeInterface $type)
171171
{
172-
$this->parents[$class = \get_class($type->getInnerType())] = array();
172+
$this->parents[$class = \get_class($type->getInnerType())] = [];
173173

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

Console/Descriptor/JsonDescriptor.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,30 @@ protected function describeDefaults(array $options)
3333
$this->writeData($data, $options);
3434
}
3535

36-
protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = array())
36+
protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = [])
3737
{
3838
$this->collectOptions($resolvedFormType);
3939

4040
if ($options['show_deprecated']) {
4141
$this->filterOptionsByDeprecated($resolvedFormType);
4242
}
4343

44-
$formOptions = array(
44+
$formOptions = [
4545
'own' => $this->ownOptions,
4646
'overridden' => $this->overriddenOptions,
4747
'parent' => $this->parentOptions,
4848
'extension' => $this->extensionOptions,
4949
'required' => $this->requiredOptions,
50-
);
50+
];
5151
$this->sortOptions($formOptions);
5252

53-
$data = array(
53+
$data = [
5454
'class' => \get_class($resolvedFormType->getInnerType()),
5555
'block_prefix' => $resolvedFormType->getInnerType()->getBlockPrefix(),
5656
'options' => $formOptions,
5757
'parent_types' => $this->parents,
5858
'type_extensions' => $this->extensions,
59-
);
59+
];
6060

6161
$this->writeData($data, $options);
6262
}
@@ -65,19 +65,19 @@ protected function describeOption(OptionsResolver $optionsResolver, array $optio
6565
{
6666
$definition = $this->getOptionDefinition($optionsResolver, $options['option']);
6767

68-
$map = array();
68+
$map = [];
6969
if ($definition['deprecated']) {
7070
$map['deprecated'] = 'deprecated';
7171
if (\is_string($definition['deprecationMessage'])) {
7272
$map['deprecation_message'] = 'deprecationMessage';
7373
}
7474
}
75-
$map += array(
75+
$map += [
7676
'required' => 'required',
7777
'default' => 'default',
7878
'allowed_types' => 'allowedTypes',
7979
'allowed_values' => 'allowedValues',
80-
);
80+
];
8181
foreach ($map as $label => $name) {
8282
if (array_key_exists($name, $definition)) {
8383
$data[$label] = $definition[$name];

Console/Descriptor/TextDescriptor.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,28 @@ protected function describeDefaults(array $options)
5353
}
5454
}
5555

56-
protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = array())
56+
protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = [])
5757
{
5858
$this->collectOptions($resolvedFormType);
5959

6060
if ($options['show_deprecated']) {
6161
$this->filterOptionsByDeprecated($resolvedFormType);
6262
}
6363

64-
$formOptions = $this->normalizeAndSortOptionsColumns(array_filter(array(
64+
$formOptions = $this->normalizeAndSortOptionsColumns(array_filter([
6565
'own' => $this->ownOptions,
6666
'overridden' => $this->overriddenOptions,
6767
'parent' => $this->parentOptions,
6868
'extension' => $this->extensionOptions,
69-
)));
69+
]));
7070

7171
// setting headers and column order
72-
$tableHeaders = array_intersect_key(array(
72+
$tableHeaders = array_intersect_key([
7373
'own' => 'Options',
7474
'overridden' => 'Overridden options',
7575
'parent' => 'Parent options',
7676
'extension' => 'Extension options',
77-
), $formOptions);
77+
], $formOptions);
7878

7979
$this->output->title(sprintf('%s (Block prefix: "%s")', \get_class($resolvedFormType->getInnerType()), $resolvedFormType->getInnerType()->getBlockPrefix()));
8080

@@ -98,42 +98,42 @@ protected function describeOption(OptionsResolver $optionsResolver, array $optio
9898
$definition = $this->getOptionDefinition($optionsResolver, $options['option']);
9999

100100
$dump = $this->getDumpFunction();
101-
$map = array();
101+
$map = [];
102102
if ($definition['deprecated']) {
103-
$map = array(
103+
$map = [
104104
'Deprecated' => 'deprecated',
105105
'Deprecation message' => 'deprecationMessage',
106-
);
106+
];
107107
}
108-
$map += array(
108+
$map += [
109109
'Required' => 'required',
110110
'Default' => 'default',
111111
'Allowed types' => 'allowedTypes',
112112
'Allowed values' => 'allowedValues',
113113
'Normalizer' => 'normalizer',
114-
);
115-
$rows = array();
114+
];
115+
$rows = [];
116116
foreach ($map as $label => $name) {
117117
$value = array_key_exists($name, $definition) ? $dump($definition[$name]) : '-';
118118
if ('default' === $name && isset($definition['lazy'])) {
119119
$value = "Value: $value\n\nClosure(s): ".$dump($definition['lazy']);
120120
}
121121

122-
$rows[] = array("<info>$label</info>", $value);
122+
$rows[] = ["<info>$label</info>", $value];
123123
$rows[] = new TableSeparator();
124124
}
125125
array_pop($rows);
126126

127127
$this->output->title(sprintf('%s (%s)', \get_class($options['type']), $options['option']));
128-
$this->output->table(array(), $rows);
128+
$this->output->table([], $rows);
129129
}
130130

131131
private function buildTableRows(array $headers, array $options): array
132132
{
133-
$tableRows = array();
133+
$tableRows = [];
134134
$count = \count(max($options));
135135
for ($i = 0; $i < $count; ++$i) {
136-
$cells = array();
136+
$cells = [];
137137
foreach (array_keys($headers) as $group) {
138138
$option = $options[$group][$i] ?? null;
139139
if (\is_string($option) && \in_array($option, $this->requiredOptions, true)) {
@@ -161,7 +161,7 @@ private function normalizeAndSortOptionsColumns(array $options)
161161
}
162162

163163
if (!$sorted) {
164-
$options[$group] = array();
164+
$options[$group] = [];
165165
} else {
166166
$options[$group][] = null;
167167
}
@@ -184,15 +184,15 @@ private function normalizeAndSortOptionsColumns(array $options)
184184
private function getDumpFunction()
185185
{
186186
$cloner = new VarCloner();
187-
$cloner->addCasters(array('Closure' => function ($c, $a) {
187+
$cloner->addCasters(['Closure' => function ($c, $a) {
188188
$prefix = Caster::PREFIX_VIRTUAL;
189189

190-
return array(
190+
return [
191191
$prefix.'parameters' => isset($a[$prefix.'parameters']) ? \count($a[$prefix.'parameters']->value) : 0,
192192
$prefix.'file' => $a[$prefix.'file'],
193193
$prefix.'line' => $a[$prefix.'line'],
194-
);
195-
}));
194+
];
195+
}]);
196196
$dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
197197
$dumper->setColors($this->output->isDecorated());
198198

Extension/Core/Type/FormType.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
8181
}
8282

8383
$formConfig = $form->getConfig();
84-
$view->vars = array_replace($view->vars, array(
84+
$view->vars = array_replace($view->vars, [
8585
'errors' => $form->getErrors(),
8686
'valid' => $form->isSubmitted() ? $form->isValid() : true,
8787
'value' => $form->getViewData(),
@@ -95,7 +95,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
9595
'method' => $formConfig->getMethod(),
9696
'action' => $formConfig->getAction(),
9797
'submitted' => $form->isSubmitted(),
98-
));
98+
]);
9999
}
100100

101101
/**
@@ -138,7 +138,7 @@ public function configureOptions(OptionsResolver $resolver)
138138
}
139139

140140
return function (FormInterface $form) {
141-
return $form->getConfig()->getCompound() ? array() : '';
141+
return $form->getConfig()->getCompound() ? [] : '';
142142
};
143143
};
144144

@@ -157,11 +157,11 @@ public function configureOptions(OptionsResolver $resolver)
157157

158158
// If data is given, the form is locked to that data
159159
// (independent of its value)
160-
$resolver->setDefined(array(
160+
$resolver->setDefined([
161161
'data',
162-
));
162+
]);
163163

164-
$resolver->setDefaults(array(
164+
$resolver->setDefaults([
165165
'data_class' => $dataClass,
166166
'empty_data' => $emptyData,
167167
'trim' => true,
@@ -170,24 +170,24 @@ public function configureOptions(OptionsResolver $resolver)
170170
'mapped' => true,
171171
'by_reference' => true,
172172
'error_bubbling' => $errorBubbling,
173-
'label_attr' => array(),
173+
'label_attr' => [],
174174
'inherit_data' => false,
175175
'compound' => true,
176176
'method' => 'POST',
177177
// According to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt)
178178
// section 4.2., empty URIs are considered same-document references
179179
'action' => '',
180-
'attr' => array(),
180+
'attr' => [],
181181
'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.',
182182
'upload_max_size_message' => $uploadMaxSizeMessage, // internal
183183
'allow_file_upload' => false,
184184
'help' => null,
185-
'help_attr' => array(),
186-
));
185+
'help_attr' => [],
186+
]);
187187

188188
$resolver->setAllowedTypes('label_attr', 'array');
189-
$resolver->setAllowedTypes('upload_max_size_message', array('callable'));
190-
$resolver->setAllowedTypes('help', array('string', 'null'));
189+
$resolver->setAllowedTypes('upload_max_size_message', ['callable']);
190+
$resolver->setAllowedTypes('help', ['string', 'null']);
191191
$resolver->setAllowedTypes('help_attr', 'array');
192192
}
193193

0 commit comments

Comments
 (0)