8000 bug #16101 [Form] add missing deprecation triggers (xabbuh) · wouterj/symfony@c9e938c · GitHub
[go: up one dir, main page]

Skip to content

Commit c9e938c

Browse files
committed
bug symfony#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 | symfony#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
2 parents cdbabb0 + bcd3946 commit c9e938c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public function __construct($validator, ViolationMapperInterface $violationMappe
4646
throw new \InvalidArgumentException('Validator must be instance of Symfony\Component\Validator\Validator\ValidatorInterface or Symfony\Component\Validator\ValidatorInterface');
4747
}
4848

49+
if ($validator instanceof LegacyValidatorInterface) {
50+
@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);
51+
}
52+
4953
$this->validator = $validator;
5054
$this->violationMapper = $violationMapper;
5155
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct($validator)
4040
$metadata = $validator->getMetadataFor('Symfony\Component\Form\Form');
4141
// 2.4 API
4242
} elseif ($validator instanceof LegacyValidatorInterface) {
43+
@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);
4344
$metadata = $validator->getMetadataFactory()->getMetadataFor('Symfony\Component\Form\Form');
4445
} else {
4546
throw new UnexpectedTypeException($validator, 'Symfony\Component\Validator\Validator\ValidatorInterface or Symfony\Component\Validator\ValidatorInterface');

0 commit comments

Comments
 (0)
0