Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Validator] Add the match option to the Choice constraint#45977
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| * Deprecate constraint`ExpressionLanguageSyntax`, use`ExpressionSyntax` instead | ||
| * Add method`__toString()` to`ConstraintViolationInterface` &`ConstraintViolationListInterface` | ||
| * Allow creating constraints with required arguments | ||
| * Add the`match` option to the`Choice` constraint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I had to read the description of the PR to get what this was for.
Maybe it's a naming issue? Wouldnegate be better instead? I'm not sure, just trying :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Another possible naming isshouldMatch, as it's more clear to understand that a boolean is expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I've spent some time thinking about this. I didn't find any reasonable alternative. The whole concept seems like an edge case anyway, so let's keepmatch (at least, this is the same name as for Regexp). Doc should be well written though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
And of course, if anyone has a better name before 6.2 final, we will be able to change it quickly.
cc @symfony/mergers
Thank you@fancyweb. |
Uh oh!
There was an error while loading.Please reload this page.
I'd like to add a
matchoption like the one in theRegexconstraint to validate that a value isnot in a given set of choices.Reusing the
Choiceconstraint with a flag instead of creating theNotChoiceconstraint looks way better to me.