Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
FixConstraintViolation#getPropertyPath() to always returnstring#40415
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
FixConstraintViolation#getPropertyPath() to always returnstring#40415
Uh oh!
There was an error while loading.Please reload this page.
Conversation
`ConstraintViolation#getPropertyPath()`'s inherited signature states that `string` isto be returned by it at all times, yet the implementation returns `null` when no propertypath had been provided at instantiation.This patch obviates it, returning an empty string when theproperty path is `null`.
Ocramius commentedMar 8, 2021
Integration test suite failure seems unrelated |
derrabus commentedMar 8, 2021
Good catch. We have the same problem with the |
Ocramius commentedMar 8, 2021
That ship has sailed though, and there's active design around the property path being missing. |
derrabus commentedMar 8, 2021
Yeah, for sure, we cannot just change the type now. But if it's a mistake, we could try to correct it for Symfony 6. The parameter types for Our own code ( |
Ocramius commentedMar 8, 2021
I was copying violations reported from one validator to another, pretty much like |
Nyholm commentedMar 8, 2021
Thank you. Could you do the same fix for the |
Ocramius commentedMar 8, 2021
Will send a separate patch |
`ConstraintViolation#getMessageTemplate()`'s inherited signature states that `string` isto be returned by it at all times, yet the implementation returns `null` when no messagetemplate had been provided at instantiation.This patch obviates it, returning an empty string when themessage template is `null`.Ref:symfony#40415 (comment)
derrabus commentedMar 8, 2021
I still think we should perform the string cast inside the constructor though. 🙃 btw: is the 4.4 branch affected as well? |
Nyholm commentedMar 8, 2021
Hm, the small benefit to cast it to a string in the constructor is that we can remove the cast in the |
Ocramius commentedMar 8, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
You do that, you break subclassing types for little benefit. I can imagine that some subclassing will likely rely on the fact that EDIT: keep in mind that the scope of this is abugfix, not a refactoring. That would probably target |
Ocramius commentedMar 8, 2021
Possibly, didn't check, since I'd rather leave 4.4 alone. This is the sort of bugfix that I would never ever want to see in an LTS, since there's a subtle change in behavior. |
derrabus commentedMar 8, 2021
|
Ocramius commentedMar 8, 2021
Ah, true that 👍 |
fabpot commentedMar 10, 2021
Thank you@Ocramius. |
`ConstraintViolation#getMessageTemplate()`'s inherited signature states that `string` isto be returned by it at all times, yet the implementation returns `null` when no messagetemplate had been provided at instantiation.This patch obviates it, returning an empty string when themessage template is `null`.Ref:symfony#40415 (comment)
`ConstraintViolation#getMessageTemplate()`'s inherited signature states that `string` isto be returned by it at all times, yet the implementation returns `null` when no messagetemplate had been provided at instantiation.This patch obviates it, returning an empty string when themessage template is `null`.Ref:symfony#40415 (comment)
…eturn `string` (Ocramius)This PR was merged into the 5.2 branch.Discussion----------Fix `ConstraintViolation#getMessageTemplate()` to always return `string`| Q | A| ------------- | ---| Branch? | 5.2| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets || License | MIT| Doc PR |`ConstraintViolation#getMessageTemplate()`'s inherited signature states that `string` isto be returned by it at all times, yet the implementation returns `null` when no messagetemplate had been provided at instantiation.This patch obviates it, returning an empty string when themessage template is `null`.Ref:#40415 (comment)Commits-------72a464e Fix `ConstraintViolation#getMessageTemplate()` to always return `string`
`ConstraintViolation#getMessageTemplate()`'s inherited signature states that `string` isto be returned by it at all times, yet the implementation returns `null` when no messagetemplate had been provided at instantiation.This patch obviates it, returning an empty string when themessage template is `null`.Ref:symfony/symfony#40415 (comment)
…eturn `string` (Ocramius)This PR was merged into the 5.2 branch.Discussion----------Fix `ConstraintViolation#getMessageTemplate()` to always return `string`| Q | A| ------------- | ---| Branch? | 5.2| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets || License | MIT| Doc PR |`ConstraintViolation#getMessageTemplate()`'s inherited signature states that `string` isto be returned by it at all times, yet the implementation returns `null` when no messagetemplate had been provided at instantiation.This patch obviates it, returning an empty string when themessage template is `null`.Ref:symfony/symfony#40415 (comment)Commits-------72a464e449 Fix `ConstraintViolation#getMessageTemplate()` to always return `string`
ConstraintViolation#getPropertyPath()'s inherited signature states thatstringisto be returned by it at all times, yet the implementation returns
nullwhen no propertypath had been provided at instantiation.
This patch obviates it, returning an empty string when the
property path is
null.