bug #16101 [Form] add missing deprecation triggers (xabbuh)
This PR was merged into the 2.8 branch.
Discussion
----------
[Form] add missing deprecation triggers
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #15767
| License | MIT
| Doc PR |
Passing implementations of the pre 2.5 validator API to the constructors
of the `ValidatorExtension` and the `ValidationListener` must trigger a
deprecation.
Commits
-------
bcd3946
[Form] add missing deprecation triggers
This commit is contained in:
commit
c9e938cfea
@ -46,6 +46,10 @@ class ValidationListener implements EventSubscriberInterface
|
||||
throw new \InvalidArgumentException('Validator must be instance of Symfony\Component\Validator\Validator\ValidatorInterface or Symfony\Component\Validator\ValidatorInterface');
|
||||
}
|
||||
|
||||
if ($validator instanceof LegacyValidatorInterface) {
|
||||
@trigger_error('Passing an instance of Symfony\Component\Validator\ValidatorInterface as argument to the '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use an implementation of Symfony\Component\Validator\Validator\ValidatorInterface instead', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->validator = $validator;
|
||||
$this->violationMapper = $violationMapper;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ class ValidatorExtension extends AbstractExtension
|
||||
$metadata = $validator->getMetadataFor('Symfony\Component\Form\Form');
|
||||
// 2.4 API
|
||||
} elseif ($validator instanceof LegacyValidatorInterface) {
|
||||
@trigger_error('Passing an instance of Symfony\Component\Validator\ValidatorInterface as argument to the '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use an implementation of Symfony\Component\Validator\Validator\ValidatorInterface instead', E_USER_DEPRECATED);
|
||||
$metadata = $validator->getMetadataFactory()->getMetadataFor('Symfony\Component\Form\Form');
|
||||
} else {
|
||||
throw new UnexpectedTypeException($validator, 'Symfony\Component\Validator\Validator\ValidatorInterface or Symfony\Component\Validator\ValidatorInterface');
|
||||
|
Reference in New Issue
Block a user