-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Validator] Accept Stringable in ExecutionContext::build/addViolation()
#54487
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
Conversation
Stringable in `ExecutionContext::build/addViolat…Stringable in ExecutionContext::build/addViolation()
|
Just to be sure: this matters only when strict types are enabled, right? Looking at the |
|
Indeed! It works as-is when strict types are disabled. I guess we have to wait for the next major to update the interface, even if it's a bug? |
394b514 to
edcc2d8
Compare
|
Ah no sorry, the change was fine for 6.4. |
edcc2d8 to
394b514
Compare
|
Got back to 6.4. 👍 I think this is something that may be doable with some custom PHPStan rule? I didn't play with this yet, that's an interesting case. I'll try something when I have some time. |
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.
Note that strict types are just a bad idea :)
|
Thank you @alexandre-daubois. |
ConstraintViolationBuilderaccepts any stringable. We mentioned this in the doc but it doesn't work as explained in the issue. I thinkbuildViolation()could accept stringable, also given thatExecutionContextInterfacedefines the type asstring|Stringablein the PHPDoc.Same for
addViolation().