-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] fixed duplicate constraints with parent class interfaces #19580
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
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) { | ||
if ( | ||
'Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name || | ||
$parent && $parent->implementsInterface($interface->name) |
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.
Does it work for a child of a child?
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 should work 😉 No matter at which level (starting at the parent then going upwards to the parent of the parent etc.) the interface is implemented this condition will be true.
Or what exactly do you mean?
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 mean I was wondering about the pertinence of adding a test for it but you look pretty sure :)
f411c08
to
7b4d8b1
Compare
foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) { | ||
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) { | ||
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name | ||
|| $parent && $parent->implementsInterface($interface->name) |
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'd keep the condition in a single line, but add parenthesis to make precedence explicit.
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.
We don't enforce line length in Symfony, so keeping everything on one line is the way to go.
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 changed it 👍
@webmozart you are probably the most qualified to say if this fix is correct? 😊 |
@fabpot @stof @nicolas-grekas who could have a look at this? 😊 |
👍 |
Thank you @dmaicher. |
…interfaces (dmaicher) This PR was merged into the 2.7 branch. Discussion ---------- [Validator] fixed duplicate constraints with parent class interfaces | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #19516 | License | MIT | Doc PR | - This fixes #19516 Commits ------- fb36c5a [Validator] fixed duplicate constraints with parent class interfaces
This fixes #19516