Skip to content

Commit bb97fdb

Browse files
committed
Fix CS
1 parent eea7b99 commit bb97fdb

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@
1717
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
1818
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
1919
use Symfony\Component\Form\Extension\Core\Type\FormType;
20-
use Symfony\Component\Form\Extension\Core\Type\TextType;
2120
use Symfony\Component\Form\Form;
2221
use Symfony\Component\Form\FormBuilder;
23-
use Symfony\Component\Form\FormConfigBuilder;
2422
use Symfony\Component\Form\FormError;
2523
use Symfony\Component\Form\FormFactory;
2624
use Symfony\Component\Form\FormFactoryInterface;
2725
use Symfony\Component\Form\Forms;
2826
use Symfony\Component\Form\RequestHandlerInterface;
29-
use Symfony\Component\Form\ResolvedFormType;
3027
use Symfony\Component\Form\Util\ServerParams;
3128

3229
/**
@@ -77,7 +74,7 @@ public function testSubmitCheckboxInCollectionFormWithEmptyData($method)
7774
{
7875
$form = $this->factory->create(CollectionType::class, [true, false, true], [
7976
'entry_type' => CheckboxType::class,
80-
'method' => $method
77+
'method' => $method,
8178
]);
8279

8380
$this->setRequestData($method, [
@@ -95,13 +92,13 @@ public function testSubmitCheckboxInCollectionFormWithPartialData($method)
9592
{
9693
$form = $this->factory->create(CollectionType::class, [true, false, true], [
9794
'entry_type' => CheckboxType::class,
98-
'method' => $method
95+
'method' => $method,
9996
]);
10097

10198
$this->setRequestData($method, [
10299
'collection' => [
103-
1 => true
104-
]
100+
1 => true,
101+
],
105102
]);
106103

107104
$this->requestHandler->handleRequest($form, $this->request);
@@ -115,10 +112,10 @@ public function testSubmitCheckboxInCollectionFormWithPartialData($method)
115112
public function testSubmitCheckboxFormWithEmptyData($method)
116113
{
117114
$form = $this->factory->create(FormType::class, ['subform' => ['checkbox' => true]], [
118-
'method' => $method
115+
'method' => $method,
119116
])
120117
->add('subform', FormType::class, [
121-
'compound' => true
118+
'compound' => true,
122119
]);
123120

124121
$form->get('subform')
@@ -137,7 +134,7 @@ public function testSubmitCheckboxFormWithEmptyData($method)
137134
public function testSubmitSimpleCheckboxFormWithEmptyData($method)
138135
{
139136
$form = $this->factory->createNamed('checkbox', CheckboxType::class, true, [
140-
'method' => $method
137+
'method' => $method,
141138
]);
142139

143140
$this->setRequestData($method, []);
@@ -476,14 +473,14 @@ public function testFailedFileUploadIsTurnedIntoFormError($errorCode, $expectedE
476473
public function uploadFileErrorCodes()
477474
{
478475
return [
479-
'no error' => [\UPLOAD_ERR_OK, null],
476+
'no error' => [\UPLOAD_ERR_OK, null],
480477
'upload_max_filesize ini directive' => [\UPLOAD_ERR_INI_SIZE, \UPLOAD_ERR_INI_SIZE],
481-
'MAX_FILE_SIZE from form' => [\UPLOAD_ERR_FORM_SIZE, \UPLOAD_ERR_FORM_SIZE],
482-
'partially uploaded' => [\UPLOAD_ERR_PARTIAL, \UPLOAD_ERR_PARTIAL],
483-
'no file upload' => [\UPLOAD_ERR_NO_FILE, \UPLOAD_ERR_NO_FILE],
484-
'missing temporary directory' => [\UPLOAD_ERR_NO_TMP_DIR, \UPLOAD_ERR_NO_TMP_DIR],
485-
'write failure' => [\UPLOAD_ERR_CANT_WRITE, \UPLOAD_ERR_CANT_WRITE],
486-
'stopped by extension' => [\UPLOAD_ERR_EXTENSION, \UPLOAD_ERR_EXTENSION],
478+
'MAX_FILE_SIZE from form' => [\UPLOAD_ERR_FORM_SIZE, \UPLOAD_ERR_FORM_SIZE],
479+
'partially uploaded' => [\UPLOAD_ERR_PARTIAL, \UPLOAD_ERR_PARTIAL],
480+
'no file upload' => [\UPLOAD_ERR_NO_FILE, \UPLOAD_ERR_NO_FILE],
481+
'missing temporary directory' => [\UPLOAD_ERR_NO_TMP_DIR, \UPLOAD_ERR_NO_TMP_DIR],
482+
'write failure' => [\UPLOAD_ERR_CANT_WRITE, \UPLOAD_ERR_CANT_WRITE],
483+
'stopped by extension' => [\UPLOAD_ERR_EXTENSION, \UPLOAD_ERR_EXTENSION],
487484
];
488485
}
489486

src/Symfony/Component/Form/Traits/MissingDataHandlerTrait.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Form\Traits;
413

514
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
@@ -11,6 +20,7 @@ trait MissingDataHandlerTrait
1120
public function handleMissingData(FormInterface $form, $data)
1221
{
1322
$processedData = $this->handler()->handleMissingData($form, $data);
23+
1424
return $processedData === $this->handler()->missingData() ? $data : $processedData;
1525
}
1626

@@ -28,6 +38,7 @@ private function handler()
2838
public function missingData()
2939
{
3040
static $missingData;
41+
3142
return $missingData ?? $missingData = new \stdClass();
3243
}
3344

@@ -40,7 +51,7 @@ public function handleMissingData(FormInterface $form, $data)
4051
return $falseValues[0];
4152
}
4253

43-
if (in_array($data, $falseValues)) {
54+
if (\in_array($data, $falseValues)) {
4455
return $data;
4556
}
4657
}
@@ -49,7 +60,7 @@ public function handleMissingData(FormInterface $form, $data)
4960
$data = $form->getConfig()->getCompound() ? [] : $data;
5061
}
5162

52-
if (is_array($data)) {
63+
if (\is_array($data)) {
5364
$children = $form->getConfig()->getCompound() ? $form->all() : [$form];
5465

5566
foreach ($children as $child) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy