-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Add support of PHP backed enumerations #40830
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
[Serializer] Add support of PHP backed enumerations #40830
Conversation
alexandre-daubois
commented
Apr 15, 2021
•
edited
Loading
edited
Q | A |
---|---|
Branch? | 5.4 |
Bug fix? | no |
New feature? | yes |
Deprecations? | no |
Tickets | Fix #40241 |
License | MIT |
Doc PR | none |
2b935bc
to
894f1d7
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.
Why only BackedEnum? can't we also normalize Enum via Reflexion?
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Tests/Fixtures/IntegerBackedEnumDummy.php
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Tests/Fixtures/IntegerBackedEnumDummy.php
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php
Outdated
Show resolved
Hide resolved
894f1d7
to
0419400
Compare
Thank you for your reviews!
@stof commented in the original ticket #40241 that we should only create this normalizer for
Edit: added version check in d8298fa |
0419400
to
d8298fa
Compare
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
29b08fe
to
7d9709e
Compare
src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
7d9709e
to
0a07caa
Compare
0a07caa
to
6e01a7a
Compare
Changed |
src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
e7c1a97
to
ca6abf6
Compare
ca6abf6
to
0872747
Compare
Rebased to 4.4, as it is considered a bug fix. How to deal with the change of configuration format, going from XML to PHP configuration in latest Symfony version? |
Thanks. We'll deal with it while merging up. |
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php
Outdated
Show resolved
Hide resolved
0872747
to
e9ed1e8
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.
As it adds a new class to support it, I would say this is out of the "merge in 4.4 to support a new PHP version". I think it qualifies as a new feature, so for 5.4.
e9ed1e8
to
3458e0e
Compare
Alright! Rebase to 5.4 is done |
Thank you @alexandre-daubois. |
This PR was merged into the 5.4 branch. Discussion ---------- Add missing types to BackedEnumNormalizer | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Spotted while reviewing #47296 Not sure why we missed adding them in #40830 🤷 Commits ------- 60d6325 [Serializer] Add missing types to BackedEnumNormalizer