bug #31908 [Validator] fix deprecation layer of ValidatorBuilder (nicolas-grekas)

This PR was merged into the 4.2 branch.

Discussion
----------

[Validator] fix deprecation layer of ValidatorBuilder

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

As identified in https://github.com/symfony/symfony/pull/31898: we cannot remove the interface and make the replacing implementation final in the same run. This PR turns only setTranslator() final to allow changing its type hint in 5.0.

Commits
-------

154ce81519 [Validator] fix deprecation layer of ValidatorBuilder
This commit is contained in:
Nicolas Grekas 2019-06-06 20:29:27 +02:00
commit d98dd9bd82
4 changed files with 5 additions and 5 deletions

View File

@ -385,7 +385,7 @@ Validator
* The `symfony/translation` dependency has been removed - run `composer require symfony/translation` if you need the component
* The `checkMX` and `checkHost` options of the `Email` constraint are deprecated
* The component is now decoupled from `symfony/translation` and uses `Symfony\Contracts\Translation\TranslatorInterface` instead
* The `ValidatorBuilderInterface` has been deprecated and `ValidatorBuilder` made final
* The `ValidatorBuilderInterface` has been deprecated and `ValidatorBuilder::setTranslator()` has been made final
* Deprecated validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator`. Use `Type` instead or remove the constraint if the underlying model is type hinted to `\DateTimeInterface` already.
* Using the `Bic`, `Country`, `Currency`, `Language` and `Locale` constraints without `symfony/intl` is deprecated
* Using the `Email` constraint in strict mode without `egulias/email-validator` is deprecated

View File

@ -259,7 +259,7 @@ Validator
* Calling `EmailValidator::__construct()` method with a boolean parameter has been removed, use `EmailValidator("strict")` instead.
* Removed the `checkDNS` and `dnsMessage` options from the `Url` constraint.
* The component is now decoupled from `symfony/translation` and uses `Symfony\Contracts\Translation\TranslatorInterface` instead
* The `ValidatorBuilderInterface` has been removed and `ValidatorBuilder` is now final
* The `ValidatorBuilderInterface` has been removed
* Removed support for validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator`. Use `Type` instead or remove the constraint if the underlying model is type hinted to `\DateTimeInterface` already.
* The `symfony/intl` component is now required for using the `Bic`, `Country`, `Currency`, `Language` and `Locale` constraints
* The `egulias/email-validator` component is now required for using the `Email` constraint in strict mode

View File

@ -9,7 +9,7 @@ CHANGELOG
* added `DivisibleBy` constraint
* decoupled from `symfony/translation` by using `Symfony\Contracts\Translation\TranslatorInterface`
* deprecated `ValidatorBuilderInterface`
* made `ValidatorBuilder` final
* made `ValidatorBuilder::setTranslator()` final
* marked `format` the default option in `DateTime` constraint
* deprecated validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator`.
* deprecated using the `Bic`, `Country`, `Currency`, `Language` and `Locale` constraints without `symfony/intl`

View File

@ -38,8 +38,6 @@ use Symfony\Contracts\Translation\TranslatorTrait;
* The default implementation of {@link ValidatorBuilderInterface}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @final since Symfony 4.2
*/
class ValidatorBuilder implements ValidatorBuilderInterface
{
@ -255,6 +253,8 @@ class ValidatorBuilder implements ValidatorBuilderInterface
/**
* {@inheritdoc}
*
* @final since Symfony 4.2
*/
public function setTranslator(LegacyTranslatorInterface $translator)
{