Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] Allow opt-out of EmailValidator deprecation when using Validation::createValidatorBuilder() #48644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 6.2
Bug fix? yes
New feature? yes
Deprecations? yes
Tickets Fix #48541
License MIT
Doc PR -

As described in the linked issue, there is currently no way to opt out from a deprecation triggered by a validator when using the component standalone.

The example at hand presently is "The "loose" mode is deprecated. The default mode will be changed to "html5" in 7.0" as triggered by EmailValidator. There could be others in the future.

This PR provides a way around:

$builder = Validation::createValidatorBuilder()
	->setConstraintValidatorFactory(new ConstraintValidatorFactory([EmailValidator::class => new EmailValidator(Email::VALIDATION_MODE_HTML5)]));

That's a bit verbose, but that does the job in a future-proof way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant