Skip to content

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