Skip to content

Commit e7c7d1d

Browse files
CS fixes
1 parent 12fc5eb commit e7c7d1d

File tree

12 files changed

+115
-115
lines changed

12 files changed

+115
-115
lines changed

ChoiceList/ArrayChoiceList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private function castableToString(array $choices, array &$cache = []): bool
219219
}
220220

221221
continue;
222-
} elseif (!is_scalar($choice)) {
222+
} elseif (!\is_scalar($choice)) {
223223
return false;
224224
}
225225

Extension/Core/EventListener/TransformationFailureListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function convertTransformationFailureToFormError(FormEvent $event)
5757
}
5858
}
5959

60-
$clientDataAsString = is_scalar($form->getViewData()) ? (string) $form->getViewData() : \gettype($form->getViewData());
60+
$clientDataAsString = \is_scalar($form->getViewData()) ? (string) $form->getViewData() : \gettype($form->getViewData());
6161
$messageTemplate = 'The value {{ value }} is not valid.';
6262

6363
if (null !== $this->translator) {

Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
175175
if (\count($unknownValues) > 0) {
176176
$form = $event->getForm();
177177

178-
$clientDataAsString = is_scalar($form->getViewData()) ? (string) $form->getViewData() : (\is_array($form->getViewData()) ? implode('", "', array_keys($unknownValues)) : \gettype($form->getViewData()));
178+
$clientDataAsString = \is_scalar($form->getViewData()) ? (string) $form->getViewData() : (\is_array($form->getViewData()) ? implode('", "', array_keys($unknownValues)) : \gettype($form->getViewData()));
179179

180180
if (null !== $this->translator) {
181181
$message = $this->translator->trans($messageTemplate, ['{{ value }}' => $clientDataAsString], 'validators');

Extension/Core/Type/FileType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private function getFileUploadError(int $errorCode)
183183
*/
184184
private static function getMaxFilesize()
185185
{
186-
$iniMax = strtolower(ini_get('upload_max_filesize'));
186+
$iniMax = strtolower(\ini_get('upload_max_filesize'));
187187

188188
if ('' === $iniMax) {
189189
return \PHP_INT_MAX;

Extension/Validator/Constraints/FormValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function validate($form, Constraint $formConstraint)
168168
// child.
169169
// See also https://github.com/symfony/symfony/issues/4359
170170
if ($childrenSynchronized) {
171-
$clientDataAsString = is_scalar($form->getViewData())
171+
$clientDataAsString = \is_scalar($form->getViewData())
172172
? (string) $form->getViewData()
173173
: \gettype($form->getViewData());
174174

Form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public function setData($modelData)
355355
}
356356

357357
// Treat data as strings unless a transformer exists
358-
if (is_scalar($modelData) && !$this->config->getViewTransformers() && !$this->config->getModelTransformers()) {
358+
if (\is_scalar($modelData) && !$this->config->getViewTransformers() && !$this->config->getModelTransformers()) {
359359
$modelData = (string) $modelData;
360360
}
361361

@@ -540,7 +540,7 @@ public function submit($submittedData, $clearMissing = true)
540540
// and radio buttons with empty values.
541541
if (false === $submittedData) {
542542
$submittedData = null;
543-
} elseif (is_scalar($submittedData)) {
543+
} elseif (\is_scalar($submittedData)) {
544544
$submittedData = (string) $submittedData;
545545
} elseif ($this->config->getRequestHandler()->isFileUpload($submittedData)) {
546546
if (!$this->config->getOption('allow_file_upload')) {
@@ -1120,7 +1120,7 @@ private function normToView($value)
11201120
// compound forms is passed to the data mapper and thus should
11211121
// not be converted to a string before.
11221122
if (!($transformers = $this->config->getViewTransformers()) && !$this->config->getCompound()) {
1123-
return null === $value || is_scalar($value) ? (string) $value : $value;
1123+
return null === $value || \is_scalar($value) ? (string) $value : $value;
11241124
}
11251125

11261126
try {

Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ public function testCreateViewFlat()
216216
$view = $this->factory->createView($this->list);
217217

218218
$this->assertEquals(new ChoiceListView(
219-
[
220-
0 => new ChoiceView($this->obj1, '0', 'A'),
221-
1 => new ChoiceView($this->obj2, '1', 'B'),
222-
2 => new ChoiceView($this->obj3, '2', 'C'),
223-
3 => new ChoiceView($this->obj4, '3', 'D'),
224-
], []
219+
[
220+
0 => new ChoiceView($this->obj1, '0', 'A'),
221+
1 => new ChoiceView($this->obj2, '1', 'B'),
222+
2 => new ChoiceView($this->obj3, '2', 'C'),
223+
3 => new ChoiceView($this->obj4, '3', 'D'),
224+
], []
225225
), $view);
226226
}
227227

@@ -296,12 +296,12 @@ public function testCreateViewFlatPreferredChoicesEmptyArray()
296296
);
297297

298298
$this->assertEquals(new ChoiceListView(
299-
[
300-
0 => new ChoiceView($this->obj1, '0', 'A'),
301-
1 => new ChoiceView($this->obj2, '1', 'B'),
302-
2 => new ChoiceView($this->obj3, '2', 'C'),
303-
3 => new ChoiceView($this->obj4, '3', 'D'),
304-
], []
299+
[
300+
0 => new ChoiceView($this->obj1, '0', 'A'),
301+
1 => new ChoiceView($this->obj2, '1', 'B'),
302+
2 => new ChoiceView($this->obj3, '2', 'C'),
303+
3 => new ChoiceView($this->obj4, '3', 'D'),
304+
], []
305305
), $view);
306306
}
307307

@@ -769,95 +769,95 @@ private function assertObjectListWithCustomValues(ChoiceListInterface $list)
769769
private function assertFlatView($view)
770770
{
771771
$this->assertEquals(new ChoiceListView(
772-
[
773-
0 => new ChoiceView($this->obj1, '0', 'A'),
774-
1 => new ChoiceView($this->obj2, '1', 'B'),
775-
2 => new ChoiceView($this->obj3, '2', 'C'),
776-
3 => new ChoiceView($this->obj4, '3', 'D'),
777-
], [
778-
1 => new ChoiceView($this->obj2, '1', 'B'),
779-
2 => new ChoiceView($this->obj3, '2', 'C'),
780-
]
772+
[
773+
0 => new ChoiceView($this->obj1, '0', 'A'),
774+
1 => new ChoiceView($this->obj2, '1', 'B'),
775+
2 => new ChoiceView($this->obj3, '2', 'C'),
776+
3 => new ChoiceView($this->obj4, '3', 'D'),
777+
], [
778+
1 => new ChoiceView($this->obj2, '1', 'B'),
779+
2 => new ChoiceView($this->obj3, '2', 'C'),
780+
]
781781
), $view);
782782
}
783783

784784
private function assertFlatViewWithCustomIndices($view)
785785
{
786786
$this->assertEquals(new ChoiceListView(
787-
[
788-
'w' => new ChoiceView($this->obj1, '0', 'A'),
789-
'x' => new ChoiceView($this->obj2, '1', 'B'),
790-
'y' => new ChoiceView($this->obj3, '2', 'C'),
791-
'z' => new ChoiceView($this->obj4, '3', 'D'),
792-
], [
793-
'x' => new ChoiceView($this->obj2, '1', 'B'),
794-
'y' => new ChoiceView($this->obj3, '2', 'C'),
795-
]
787+
[
788+
'w' => new ChoiceView($this->obj1, '0', 'A'),
789+
'x' => new ChoiceView($this->obj2, '1', 'B'),
790+
'y' => new ChoiceView($this->obj3, '2', 'C'),
791+
'z' => new ChoiceView($this->obj4, '3', 'D'),
792+
], [
793+
'x' => new ChoiceView($this->obj2, '1', 'B'),
794+
'y' => new ChoiceView($this->obj3, '2', 'C'),
795+
]
796796
), $view);
797797
}
798798

799799
private function assertFlatViewWithAttr($view)
800800
{
801801
$this->assertEquals(new ChoiceListView(
802-
[
803-
0 => new ChoiceView($this->obj1, '0', 'A'),
804-
1 => new ChoiceView(
805-
$this->obj2,
806-
'1',
807-
'B',
808-
['attr1' => 'value1']
809-
),
810-
2 => new ChoiceView(
811-
$this->obj3,
812-
'2',
813-
'C',
814-
['attr2' => 'value2']
815-
),
816-
3 => new ChoiceView($this->obj4, '3', 'D'),
817-
], [
818-
1 => new ChoiceView(
819-
$this->obj2,
820-
'1',
821-
'B',
822-
['attr1' => 'value1']
823-
),
824-
2 => new ChoiceView(
825-
$this->obj3,
826-
'2',
827-
'C',
828-
['attr2' => 'value2']
829-
),
802+
[
803+
0 => new ChoiceView($this->obj1, '0', 'A'),
804+
1 => new ChoiceView(
805+
$this->obj2,
806+
'1',
807+
'B',
808+
['attr1' => 'value1']
809+
),
810+
2 => new ChoiceView(
811+
$this->obj3,
812+
'2',
813+
'C',
814+
['attr2' => 'value2']
815+
),
816+
3 => new ChoiceView($this->obj4, '3', 'D'),
817+
], [
818+
1 => new ChoiceView(
819+
$this->obj2,
820+
'1',
821+
'B',
822+
['attr1' => 'value1']
823+
),
824+
2 => new ChoiceView(
825+
$this->obj3,
826+
'2',
827+
'C',
828+
['attr2' => 'value2']
829+
),
830830
]
831831
), $view);
832832
}
833833

834834
private function assertGroupedView($view)
835835
{
836836
$this->assertEquals(new ChoiceListView(
837-
[
838-
'Group 1' => new ChoiceGroupView(
839-
'Group 1',
840-
[
841-
0 => new ChoiceView($this->obj1, '0', 'A'),
842-
1 => new ChoiceView($this->obj2, '1', 'B'),
843-
]
844-
),
845-
'Group 2' => new ChoiceGroupView(
846-
'Group 2',
847-
[
848-
2 => new ChoiceView($this->obj3, '2', 'C'),
849-
3 => new ChoiceView($this->obj4, '3', 'D'),
850-
]
851-
),
852-
], [
853-
'Group 1' => new ChoiceGroupView(
854-
'Group 1',
855-
[1 => new ChoiceView($this->obj2, '1', 'B')]
856-
),
857-
'Group 2' => new ChoiceGroupView(
858-
'Group 2',
859-
[2 => new ChoiceView($this->obj3, '2', 'C')]
860-
),
837+
[
838+
'Group 1' => new ChoiceGroupView(
839+
'Group 1',
840+
[
841+
0 => new ChoiceView($this->obj1, '0', 'A'),
842+
1 => new ChoiceView($this->obj2, '1', 'B'),
843+
]
844+
),
845+
'Group 2' => new ChoiceGroupView(
846+
'Group 2',
847+
[
848+
2 => new ChoiceView($this->obj3, '2', 'C'),
849+
3 => new ChoiceView($this->obj4, '3', 'D'),
850+
]
851+
),
852+
], [
853+
'Group 1' => new ChoiceGroupView(
854+
'Group 1',
855+
[1 => new ChoiceView($this->obj2, '1', 'B')]
856+
),
857+
'Group 2' => new ChoiceGroupView(
858+
'Group 2',
859+
[2 => new ChoiceView($this->obj3, '2', 'C')]
860+
),
861861
]
862862
), $view);
863863
}

Tests/CompoundFormTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,9 @@ public function testGetErrors()
806806
$errors = $this->form->getErrors();
807807

808808
$this->assertSame(
809-
"ERROR: Error 1\n".
810-
"ERROR: Error 2\n",
811-
(string) $errors
809+
"ERROR: Error 1\n".
810+
"ERROR: Error 2\n",
811+
(string) $errors
812812
);
813813

814814
$this->assertSame([$error1, $error2], iterator_to_array($errors));
@@ -826,15 +826,15 @@ public function testGetErrorsDeep()
826826
$errors = $this->form->getErrors(true);
827827

828828
$this->assertSame(
829-
"ERROR: Error 1\n".
830-
"ERROR: Error 2\n".
831-
"ERROR: Nested Error\n",
832-
(string) $errors
829+
"ERROR: Error 1\n".
830+
"ERROR: Error 2\n".
831+
"ERROR: Nested Error\n",
832+
(string) $errors
833833
);
834834

835835
$this->assertSame(
836-
[$error1, $error2, $nestedError],
837-
iterator_to_array($errors)
836+
[$error1, $error2, $nestedError],
837+
iterator_to_array($errors)
838838
);
839839
}
840840

@@ -850,11 +850,11 @@ public function testGetErrorsDeepRecursive()
850850
$errors = $this->form->getErrors(true, false);
851851

852852
$this->assertSame(
853-
"ERROR: Error 1\n".
854-
"ERROR: Error 2\n".
855-
"Child:\n".
856-
" ERROR: Nested Error\n",
857-
(string) $errors
853+
"ERROR: Error 1\n".
854+
"ERROR: Error 2\n".
855+
"Child:\n".
856+
" ERROR: Nested Error\n",
857+
(string) $errors
858858
);
859859

860860
$errorsAsArray = iterator_to_array($errors);

Tests/Extension/Validator/Constraints/FormValidatorFunctionalTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,12 @@ function () {
465465
}
466466
));
467467
$formBuilder->get('field2')->addModelTransformer(new CallbackTransformer(
468-
function () {
469-
},
470-
function () {
471-
throw new TransformationFailedException('This value is invalid.');
472-
}
473-
));
468+
function () {
469+
},
470+
function () {
471+
throw new TransformationFailedException('This value is invalid.');
472+
}
473+
));
474474
$form = $formBuilder->getForm();
475475

476476
$form->submit([

Tests/Extension/Validator/Constraints/FormValidatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ public function testAddInvalidErrorEvenIfNoValidationGroups()
309309
])
310310
->setData($object)
311311
->addViewTransformer(new CallbackTransformer(
312-
function ($data) { return $data; },
313-
function () { throw new TransformationFailedException(); }
314-
))
312+
function ($data) { return $data; },
313+
function () { throw new TransformationFailedException(); }
314+
))
315315
->getForm();
316316

317317
// Launch transformer

0 commit comments

Comments
 (0)