Skip to content

Commit a86790f

Browse files
committed
Changes based on review results
1 parent 3a04e79 commit a86790f

File tree

9 files changed

+10
-13
lines changed

9 files changed

+10
-13
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont
523523
{
524524
$loader->load('form.php');
525525

526-
$container->getDefinition('form.type_extension.form.validator')->setArgument(3, $config['form']['legacy_error_messages']);
526+
$container->getDefinition('form.type_extension.form.validator')->setArgument(1, $config['form']['legacy_error_messages']);
527527

528528
if (null === $config['form']['csrf_protection']['enabled']) {
529529
$config['form']['csrf_protection']['enabled'] = $config['csrf_protection']['enabled'];

src/Symfony/Bundle/FrameworkBundle/Resources/config/form.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
->set('form.type_extension.form.validator', FormTypeValidatorExtension::class)
129129
->args([
130130
service('validator'),
131+
true,
131132
service('twig.form.renderer')->ignoreOnInvalid(),
132133
service('translator')->ignoreOnInvalid(),
133134
])

src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FormTypeValidatorExtension extends BaseValidatorExtension
3030
private $violationMapper;
3131
private $legacyErrorMessages;
3232

33-
public function __construct(ValidatorInterface $validator, FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null, bool $legacyErrorMessages = true)
33+
public function __construct(ValidatorInterface $validator, bool $legacyErrorMessages = true, FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null)
3434
{
3535
$this->validator = $validator;
3636
$this->violationMapper = new ViolationMapper($formRenderer, $translator);

src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ValidatorExtension extends AbstractExtension
3131
private $translator;
3232
private $legacyErrorMessages;
3333

34-
public function __construct(ValidatorInterface $validator, FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null, bool $legacyErrorMessages = true)
34+
public function __construct(ValidatorInterface $validator, bool $legacyErrorMessages = true, FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null)
3535
{
3636
$this->legacyErrorMessages = $legacyErrorMessages;
3737

@@ -59,7 +59,7 @@ public function loadTypeGuesser()
5959
protected function loadTypeExtensions()
6060
{
6161
return [
62-
new Type\FormTypeValidatorExtension($this->validator, $this->formRenderer, $this->translator, $this->legacyErrorMessages),
62+
new Type\FormTypeValidatorExtension($this->validator, $this->legacyErrorMessages, $this->formRenderer, $this->translator),
6363
new Type\RepeatedTypeValidatorExtension(),
6464
new Type\SubmitTypeValidatorExtension(),
6565
];

src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ class ViolationMapper implements ViolationMapperInterface
2828
{
2929
private $formRenderer;
3030
private $translator;
31-
32-
/**
33-
* @var bool
34-
*/
35-
private $allowNonSynchronized;
31+
private $allowNonSynchronized = false;
3632

3733
public function __construct(FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null)
3834
{

src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ protected function getValidatorExtension(): ValidatorExtension
3939
$this->validator->expects($this->any())->method('getMetadataFor')->will($this->returnValue($metadata));
4040
$this->validator->expects($this->any())->method('validate')->will($this->returnValue(new ConstraintViolationList()));
4141

42-
return new ValidatorExtension($this->validator, null, null, false);
42+
return new ValidatorExtension($this->validator, false);
4343
}
4444
}

src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorPerformanceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FormValidatorPerformanceTest extends FormPerformanceTestCase
2323
protected function getExtensions()
2424
{
2525
return [
26-
new ValidatorExtension(Validation::createValidator(), null, null, false),
26+
new ValidatorExtension(Validation::createValidator(), false),
2727
];
2828
}
2929

src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testValidConstraint()
6464
public function testGroupSequenceWithConstraintsOption()
6565
{
6666
$form = Forms::createFormFactoryBuilder()
67-
->addExtension(new ValidatorExtension(Validation::createValidator(), null, null, false))
67+
->addExtension(new ValidatorExtension(Validation::createValidator(), false))
6868
->getFormFactory()
6969
->create(FormTypeTest::TESTED_TYPE, null, (['validation_groups' => new GroupSequence(['First', 'Second'])]))
7070
->add('field', TextTypeTest::TESTED_TYPE, [

src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function test2Dot5ValidationApi()
3535
->setMetadataFactory($metadataFactory)
3636
->getValidator();
3737

38-
$extension = new ValidatorExtension($validator, null, null, false);
38+
$extension = new ValidatorExtension($validator, false);
3939

4040
$this->assertInstanceOf(ValidatorTypeGuesser::class, $extension->loadTypeGuesser());
4141

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