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 Ulid constraint and validator#38322
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
nicolas-grekas left a comment
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.
Thnks, almost good to me.
Uh oh!
There was an error while loading.Please reload this page.
| ->addViolation(); | ||
| } | ||
| if (\strlen($value) !== strspn($value, '0123456789ABCDEFGHJKMNPQRSTVWXYZabcdefghjkmnpqrstvwxyz')) { |
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.
26 !== strspn([...]
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 think it makes more sense to keep\strlen($value) otherwise a too short ULID but with only valid characters will have violations about being too short AND having invalid characters.
The violation about invalid characters would not be true in this case.
Let me know what you think about it
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
laurent35240 commentedSep 28, 2020
Everything modified except one part which I think makes more sense how it is right now (cf comment in code review) |
fabpot commentedSep 29, 2020
Thank you@laurent35240. |
…ent35240)This PR was merged into the 5.x branch.Discussion----------[Validator] Add documentation for ULID validatorResolves#14298Related to feature PRsymfony/symfony#38322Commits-------b37ca01 [Validator] Add documention for ULID validator
ULID constraint and validator as mentioned in ticket#38103
I checked for it ulid specificationshttps://github.com/ulid/spec