You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
…e hint from phpdoc for array in constructor argument (karser)
This PR was squashed before being merged into the 3.4 branch (closes#29513).
Discussion
----------
[Hackday][Serializer] Deserialization ignores argument type hint from phpdoc for array in constructor argument
| Q | A
| ------------- | ---
| Branch? | 3.4 and up to 4.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28825
| License | MIT
This is a fix of #28825 big thanks @dunglas and @xabbuh
Commits
-------
8741d00 [Hackday][Serializer] Deserialization ignores argument type hint from phpdoc for array in constructor argument
Symfony version(s) affected: 4.2-dev and previous
Description
if class accepts array of objects in constructor It doesn't recognize the argument type hint from phpdoc and deserializes it as a plain array.
How to reproduce
I created DeserializeNestedArrayOfObjectsTest that reproduces the issue.
Additional context
Here is Zoo class (without constructor). Animal object is deserialized as expected:
Then there is ZooImmutable (with constructor), an array given instead of Animal object: <- BUG
The text was updated successfully, but these errors were encountered: