improve strict option value deprecation

This commit is contained in:
Christian Flothmann 2017-05-21 12:28:38 +02:00
parent 74faead115
commit a820b42a2d
4 changed files with 19 additions and 2 deletions

8
UPGRADE-3.4.md Normal file
View File

@ -0,0 +1,8 @@
UPGRADE FROM 3.3 to 3.4
=======================
Validator
---------
* not setting the `strict` option of the `Choice` constraint to `true` is
deprecated and will throw an exception in Symfony 4.0

View File

@ -507,6 +507,9 @@ TwigBridge
Validator Validator
--------- ---------
* The default value of the `strict` option of the `Choice` constraint was changed
to `true`. Using any other value will throw an exception.
* The `DateTimeValidator::PATTERN` constant was removed. * The `DateTimeValidator::PATTERN` constant was removed.
* `Tests\Constraints\AbstractConstraintValidatorTest` has been removed in * `Tests\Constraints\AbstractConstraintValidatorTest` has been removed in

View File

@ -1,6 +1,12 @@
CHANGELOG CHANGELOG
========= =========
3.4.0
-----
* not setting the `strict` option of the `Choice` constraint to `true` is
deprecated and will throw an exception in Symfony 4.0
3.3.0 3.3.0
----- -----

View File

@ -58,8 +58,8 @@ class ChoiceValidator extends ConstraintValidator
$choices = $constraint->choices; $choices = $constraint->choices;
} }
if (false === $constraint->strict) { if (true !== $constraint->strict) {
@trigger_error('Setting the strict option of the Choice constraint to false is deprecated since version 3.2 and will be removed in 4.0.', E_USER_DEPRECATED); @trigger_error('Not setting the strict option of the Choice constraint to true is deprecated since version 3.4 and will throw an exception in 4.0.', E_USER_DEPRECATED);
} }
if ($constraint->multiple) { if ($constraint->multiple) {