Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] New UnexpectedValueException #10551

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 Oct 24, 2018 · 0 comments
Closed

[Validator] New UnexpectedValueException #10551

ro0NL opened this issue Oct 24, 2018 · 0 comments
Milestone

Comments

@ro0NL
Copy link
Contributor

ro0NL commented Oct 24, 2018

see symfony/symfony#27917 + symfony/symfony#12312

https://symfony.com/doc/current/validation/custom_constraint.html

instead of

if (!is_string($value)) {
-    throw new UnexpectedTypeException($value, 'string');
+    throw new UnexpectedValueException($value, 'string');
}

This will cause a violation to be raised instead.

The "string" value is used with This value should be of type {{ type }}., thus should be translator friendly. E.g. core uses phpdoc notation to avoid any grammar being used here (string|int instead of string or integer and Some&Other instead of Some and Other).

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

2 participants