Skip to content
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] Fix denormalizing union types #45838

Merged
merged 1 commit into from Mar 24, 2022

Conversation

T-bond
Copy link
Contributor

@T-bond T-bond commented Mar 24, 2022

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #45818
License MIT
Doc PR -

@nicolas-grekas Replaces: #45824 as I accidentally registerred a lot of people to the notifier list when changing target branch.

Note about difference between docblock vs PHP 8 union types:
With PHP 8 union types, the resolved $types array was always (when I checked) in the same order, no matter the type definition.
So these two things: public null|boolean|DateTime and public DateTime|boolean|null would always generate an array, where the first item was DateTime.

With PHP docblock the $tpyes array order depends of the order of the documentation.
So the * @var \DateTime|bool|null would resolve to an array with DateTime as first item, but the * @var null|bool|\DateTime would resolve to the DateTime being the last element.

Copy link
Contributor Author

@T-bond T-bond left a comment

Self review done. All checks have passed.

Again, thanks for this great software! :)

Status: Reviewed

@nicolas-grekas nicolas-grekas changed the title [Serializer] Allow denormalizing union types properly [Serializer] Fix denormalizing union types Mar 24, 2022
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Mar 24, 2022

Thank you @T-bond.

Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants