Skip to content

[RFC][Validator] empty string validation #35994

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
ro0NL opened this issue Mar 7, 2020 · 0 comments
Closed

[RFC][Validator] empty string validation #35994

ro0NL opened this issue Mar 7, 2020 · 0 comments
Labels
RFC RFC = Request For Comments (proposals about features that you want to be discussed) Validator

Comments

@ro0NL
Copy link
Contributor

ro0NL commented Mar 7, 2020

This is a more concrete follow up RFC for #28611 + #31528 (https://symfony.com/blog/new-in-symfony-4-4-misc-improvements-part-1#consider-empty-strings-not-valid)

Im still having the "empty string is valid" issue, more or less unexpected for constraints Country and Email, and probably any other "string value validator".

Im pretty much convinced the "emptry string is valid" is an edge case, compared to the common case "an emptry string is not a valid email".

Also, i'd expect to safely pass e.g. ISO codes around with NotNull + Country, not NotBlank + Country.

Solving this issue allows to reduce such constraint lists to simply Country with PHP 74, moving the type responsibility to the code level: public (?)string $country.

I propose to KISS and deprecate empty strings per case.

@xabbuh xabbuh added RFC RFC = Request For Comments (proposals about features that you want to be discussed) Validator labels Mar 7, 2020
@ro0NL ro0NL closed this as completed Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC RFC = Request For Comments (proposals about features that you want to be discussed) Validator
Projects
None yet
Development

No branches or pull requests

2 participants