Skip to content

Add support for Serializer::deserialize #34

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

Merged
merged 1 commit into from
Feb 13, 2019

Conversation

mcfedr
Copy link
Contributor

@mcfedr mcfedr commented Feb 13, 2019

The return type of deserialize depends on the type you ask it for, so this gets us the correct type.

@lookyman lookyman merged commit b6f96d7 into phpstan:master Feb 13, 2019
@lookyman
Copy link
Collaborator

Thanks!


if (substr($objectName, -2) === '[]') {
// The key type is determined by the data
return new ArrayType(new MixedType(false), new ObjectType(substr($objectName, 0, -2)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part sould be recursive as you can define types like this Foo[][] and the denormalizer will handle them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right of course, #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants