Skip to content

[PropertyInfo] Backport support for typed properties (PHP 7.4) #37971

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

Merged
merged 1 commit into from
Aug 28, 2020
Merged

[PropertyInfo] Backport support for typed properties (PHP 7.4) #37971

merged 1 commit into from
Aug 28, 2020

Conversation

ogizanagi
Copy link
Contributor

@ogizanagi ogizanagi commented Aug 28, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets N/A.
License MIT
Doc PR symfony/symfony-docs#13719 to be fixed

Backports #34557 as suggested.

One of my workmate hit this issue with the Serializer component and it was not obvious for him why it was not working, without hint.

@fabpot
Copy link
Member

fabpot commented Aug 28, 2020

Thank you @ogizanagi.

@fabpot fabpot merged commit 03d494d into symfony:4.4 Aug 28, 2020
@ogizanagi ogizanagi deleted the backport-typed-properties-propinfo branch August 28, 2020 10:34
@xabbuh xabbuh added this to the 4.4 milestone Aug 30, 2020
This was referenced Aug 31, 2020
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Aug 31, 2020
…(ogizanagi)

This PR was merged into the 4.4 branch.

Discussion
----------

[PropertyAccess] Backport typed property support to 4.4

Backported in symfony/symfony#37971

Commits
-------

cc6ed26 [PropertyAccess] Backport typed property support to 4.4
fabpot added a commit that referenced this pull request Sep 4, 2020
This PR was merged into the 4.4 branch.

Discussion
----------

[PropertyInfo] Fix typed collections in PHP 7.4

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | No ticket
| License       | MIT
| Doc PR        | N/A

#37971 introduced support for typed properties in PHP 7.4, however by short circuiting the `getTypes()` method, typed collections are returned as `Type::BUILTIN_TYPE_ARRAY` without a proper collection type. If running on PHP < 7.4, the `getMutator()` method would be called which would extract the collection type from the getter/setter or adder/remover.

I updated the typedPropertiesTest to cover this case.

Commits
-------

282ed28 [PropertyInfo] Fix typed collections in PHP 7.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants