minor #36428 [Form] Removed legacy check in `ValidationListener` (HeahDude)

This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Removed legacy check in `ValidationListener`

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | ~
| License       | MIT
| Doc PR        | ~

A left over of #13198, should have been removed in 3.0. The tests don't use `null` anymore, no update needed here, this is just about removing dead code.

Commits
-------

e479e51f7c [Form] Removed legacy check in `ValidationListener`
This commit is contained in:
Fabien Potencier 2020-04-12 09:19:14 +02:00
commit db733da440
1 changed files with 1 additions and 2 deletions

View File

@ -55,8 +55,7 @@ class ValidationListener implements EventSubscriberInterface
foreach ($this->validator->validate($form) as $violation) {
// Allow the "invalid" constraint to be put onto
// non-synchronized forms
// ConstraintViolation::getConstraint() must not expect to provide a constraint as long as Symfony\Component\Validator\ExecutionContext exists (before 3.0)
$allowNonSynchronized = (null === $violation->getConstraint() || $violation->getConstraint() instanceof Form) && Form::NOT_SYNCHRONIZED_ERROR === $violation->getCode();
$allowNonSynchronized = $violation->getConstraint() instanceof Form && Form::NOT_SYNCHRONIZED_ERROR === $violation->getCode();
$this->violationMapper->mapViolation($violation, $form, $allowNonSynchronized);
}