bug #16251 Fix the detection of the deprecated usage of the ValidationListener (stof)

This PR was merged into the 2.8 branch.

Discussion
----------

Fix the detection of the deprecated usage of the ValidationListener

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #16248
| License       | MIT
| Doc PR        | n/a

the deprecation trigger should be triggered only when the valdiator does not implement the new interface. but implementing both the old and new interface is fine (and this is what is done in Symfony by default, as we provide a BC layer)

Commits
-------

de04070 Fix the detection of the deprecated usage of the ValidationListener
This commit is contained in:
Fabien Potencier 2015-10-16 13:27:11 +02:00
commit 1828d0682a

View File

@ -46,7 +46,7 @@ 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) {
if (!$validator instanceof ValidatorInterface) {
@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);
}