-
Notifications
You must be signed in to change notification settings - Fork 95
Update DenormalizerInterface::denormalize #263
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
The original stub was added here: https://github.com/phpstan/phpstan-symfony/pull/110/files#diff-d6e0c3f17a9176b0a39dd84f85be359c3c3040b510989168b8ada8c3dfd9e050R12
//cc @lucassabreu what do you think is correct here? Thank you.
For more context @lucassabreu, I have a friend returning other thing than object/array in this method, and everything working fine.
So since even the phpdoc from symfony is not restricting to object/array, I don't think we should here.
@ondrejmirtes i think it makes sense to return mixed, Symfony kind of accepts scalar types, and there is no restriction by what I understand.
I think my logic at the time was that you didn't need a Denormalizer to convert mixed to scalars or resources, but I don't think it will make the stub less effective to allow mixed.
cc: @VincentLanglet
Thank you.
Hi @ondrejmirtes
The stub from phpstan-symfony is restricting the return type to object|array, but there is no restriction in the interface from Symfony ; cf https://github.com/symfony/Serializer/blob/6.1/Normalizer/DenormalizerInterface.php.
So I changed the return type to
mixed
like the one from Symfony.