-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PropertyAccess] Handle interfaces in the invalid argument exception #21360
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
Can you add a test for this? |
|
||
/** | ||
* @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidArgumentException | ||
* @expectedExceptionMessage Expected argument of type "Countable", "string" given |
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 would have expected a test checking for the new "must implement interface" string in the exception message.
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 don't get it : the "must implement interface" comes from the PHP exception that is handled and then the InvalidArgumentException is thrown.
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.
Sorry, you are right. I misread the changes you made.
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.
👍 LGTM
Thank you @fancyweb. |
… exception (fancyweb) This PR was squashed before being merged into the 2.7 branch (closes #21360). Discussion ---------- [PropertyAccess] Handle interfaces in the invalid argument exception | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | - | License | MIT | Doc PR | - Before : `Expected argument of type "dule\MenuBundle\Entity\AbstractMenu::setMenuElements() must implement interface Doctrine\Common\Collections\Collection", "array" given` After : `Expected argument of type "Doctrine\Common\Collections\Collection", "array" given` Commits ------- be52b39 [PropertyAccess] Handle interfaces in the invalid argument exception
Before :
Expected argument of type "dule\MenuBundle\Entity\AbstractMenu::setMenuElements() must implement interface Doctrine\Common\Collections\Collection", "array" given
After :
Expected argument of type "Doctrine\Common\Collections\Collection", "array" given