-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] String normalization options for string-based validators #26484
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
[Validator] String normalization options for string-based validators #26484
Conversation
df450ee
to
226e532
Compare
7faf0e2
to
535259e
Compare
src/Symfony/Component/Validator/Constraints/NotBlankValidator.php
Outdated
Show resolved
Hide resolved
535259e
to
4194fcf
Compare
Looks good now, thanks. Some more edge cases (e.g. regular whitespaces) could be added for tests, but not sure how strict are they here yet |
Thanks for the review @Destroy666x. |
4194fcf
to
d1a0c02
Compare
src/Symfony/Component/Validator/Constraints/LengthValidator.php
Outdated
Show resolved
Hide resolved
d1a0c02
to
8e6a52f
Compare
Would it make sense to update other constraint validators too? |
Hey guys, how do you like this PR right now? |
@renan-taranto For consistency, I would add this option to the other string constraints too. |
8e6a52f
to
c21460a
Compare
a299b0b
to
795acf3
Compare
795acf3
to
a53a1fc
Compare
Hello, for me as a developer using symfony the if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { I am not sure if the same confusion will be caused later for whatever reason. Therefore my suggestion would be |
You can pass even callable which makes input pass the above check, it's your choice. Hence formatter is not good name. |
5d31a78
to
9da6661
Compare
PR updated. AppVeyor broke due to the unrelated |
9da6661
to
3a06897
Compare
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.
Could you please and a line in the changelog of the component?
3a06897
to
202d8a2
Compare
202d8a2
to
8bb60ea
Compare
Hi @nicolas-grekas, is there anything else I can do for this PR? |
7127d15
to
708d759
Compare
Thank you @renan-taranto. |
…sed validators (renan-taranto) This PR was merged into the 4.3-dev branch. Discussion ---------- [Validator] String normalization options for string-based validators | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26239 | License | MIT | Doc PR | symfony/symfony-docs#9433 Todo: - [x] Document the new options - [x] Update Doc PR Add trimming options to the string constraints. Commits ------- 708d759 [Validator] String normalization options for string-based validators
This PR was merged into the master branch. Discussion ---------- [Validator] Document the "normalizer" option Documents the PR symfony/symfony#26484 Commits ------- 6eec07b [Validator] Document the "normalizer" option
Todo:
Add trimming options to the string constraints.