Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] Deserialization ignores argument type hint from phpdoc for array in constructor argument #28825

Closed
@karser

Description

@karser

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:
image

Then there is ZooImmutable (with constructor), an array given instead of Animal object: <- BUG
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions