-
Notifications
You must be signed in to change notification settings - Fork 96
(feat): add stubs for symfony/serializer interfaces #110
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
Hi, there aren't any generics in these stubs, what do they actually solve?
hi @ondrejmirtes, today there isn't any generics on these classes.
the pr is mostly to set a element type for the $context
array on these classes, phpstan is requiring a type for it on higher levels. but in some situations these parameter is not used, so add these stubs would mean we don't have to set it on all classes.
we could say the NormalizerInterface
could be use a generic type for the return of the normalize
method, but it can set it in the implementation.
The build failures need fixing :)
------ -------------------------------------------------------------------
Line stubs/ContextAwareDenormalizerInterface.stub
------ -------------------------------------------------------------------
Reflection error:
Symfony\Component\Serializer\Normalizer\DenormalizerInterface not
found.
------ -------------------------------------------------------------------
------ -----------------------------------------------------------------------
Line stubs/DenormalizableInterface.stub
------ -----------------------------------------------------------------------
15 Parameter $denormalizer of method
Symfony\Component\Serializer\Normalizer\DenormalizableInterface::deno
rmalize() has invalid typehint type
Symfony\Component\Serializer\Normalizer\DenormalizerInterface.
15 Parameter $denormalizer of method
Symfony\Component\Serializer\Normalizer\DenormalizableInterface::deno
rmalize() has invalid typehint type
Symfony\Component\Serializer\Normalizer\DenormalizerInterface.
------ -----------------------------------------------------------------------
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.
Alright, one last round and we can merge this :)
8e3bc85
to
1b01335
Compare
Thank you!
Tagged as 0.12.11.
Hey @lucassabreu, why these stubs are needed? Symfony already has types in these interfaces and more accurate, for example EncoderInterface::encode
returns only string
. This produces false positives.
@ossinkine it seems that the types were fixed in Symfony (symfony/symfony#39451) after this PR was merged.
@mhujer Thank you but this does not explain why these stubs were created.
Hey @lucassabreu, why these stubs are needed? Symfony already has types in these interfaces and more accurate, for example
EncoderInterface::encode
returns onlystring
. This produces false positives.
Hi @ossinkine as mhujer said these interfaces didn't have the types for return and parameters, and we had to set them on every implementation before to satisfy higher levels on phpstan, but this types were ways the same and didn't make much sense to set them on my classes that were just implementing these interfaces.
the types on this pr are the ones I thought were right at the time.
if symfony has them set now i think that we can remove these stubs now for the new symfony versions.
No description provided.