Skip to content

Add string normalization option(s) to string-based validators #26239

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

Closed
Destroy666x opened this issue Feb 20, 2018 · 2 comments
Closed

Add string normalization option(s) to string-based validators #26239

Destroy666x opened this issue Feb 20, 2018 · 2 comments

Comments

@Destroy666x
Copy link

Destroy666x commented Feb 20, 2018

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version any

As the title says, it would be nice to see trimming and consecutive whitespace merging either as:

  • a single normalize option
  • two trim and mergeConsecutiveWhitespaces options

in LengthValidator at least, maybe also NotBlank if the checked value is a string

Why? Data should be normalized in general, but there are cases where you'd like to store formatted text with enough useful content, for instance forum posts.

I could do a PR, if you like the suggestion let me know which branch would be the most appropriate since it's a small feature, I guess still 4.1.x?

@Destroy666x Destroy666x changed the title Add string normalization options to string-based validators Add string normalization option(s) to string-based validators Feb 20, 2018
@Simperfit
Copy link
Contributor

@Destroy666x Hi, thanks for contributing to symfony!
I think you can do a PR against master since this is a new feature, thanks!

@renan-taranto
Copy link
Contributor

Hey, I'd like to help with this so I created a PR #26484.
It would be nice to get some feedback from you.

@fabpot fabpot closed this as completed Mar 31, 2019
fabpot added a commit that referenced this issue Mar 31, 2019
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants