-
-
Notifications
You must be signed in to change notification settings - Fork 933
feat(serializer): support for getSupportedTypes (symfony 6.3) #5672
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
feat(serializer): support for getSupportedTypes (symfony 6.3) #5672
Conversation
6315311
to
8c28bed
Compare
With this commit, all depreciations disappear ? |
it seems ok on my app, haven't tested everything yet. |
Actually quite a lot of this is covered by existing tests, so i'll mark this as ready for review! |
930ed97
to
16e7f32
Compare
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.
Thank you for working on this!
All hasCacheableSupportsMethod()
must also be deprecated (as in Symfony).
Shouldn't they be kept until APIP stops supporting older versions of SF? Using them instead of just copying their return values might be a mistake on my part though - i thought it could serve as a reminder that they are still useful for older SF versions. |
It's what we'll do, but we should trigger a deprecation anyway to be able to remove these methods when we'll drop support for old Symfony versions, as they are also part of our public API. Old versions of Symfony will still work with newer versions of API Platform, but a deprecation will be triggered (as excepted, because these methods really are deprecated :D). Also, to prevent PHPStan errors, you can use this trick: https://github.com/symfony/serializer/blob/f783a7ce6a048393f14f30e1094619f7729b1eb0/Debug/TraceableNormalizer.php#L44 |
ok, i'll add deprecations for this then (and replace the calls I added right away while I'm at it). Would version 3.2 be the correct target for these?
👍 |
No, please target 3.1. We add depreciation-free support of stable Symfony versions in all supported branches. Usually, we don't add deprecations in patch releases, but for this one, we'll make an exception because we're not responsible for this deprecation, it's one that has been introduced at the interface level by Symfony directly. |
16e7f32
to
01effad
Compare
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.
Thanks for the changes, we're almost there!
To fix the remaining deprecation notices, you need to add the @group legacy
annotation on tests testing the hasCacheableSupportsMethod()
method (btw, it would be nice to add unit tests for getSupportedTypes()
).
Normalizers from the TestBundle must also be upgraded to getSupportedTypes()
.
src/GraphQl/Serializer/Exception/RuntimeExceptionNormalizer.php
Outdated
Show resolved
Hide resolved
src/GraphQl/Serializer/Exception/ValidationExceptionNormalizer.php
Outdated
Show resolved
Hide resolved
01effad
to
189d167
Compare
189d167
to
8989521
Compare
This version should be better. I didn't add tests for getSupportedTypes() (yet?), but as they just return static arrays and are by design covered by functionnal tests I'm not sure how important those would be....? |
Thank you so much for this PR! |
This is a quick draft for completing/revisiting the work initiated here : #5611 , which seems abandoned right now.