Skip to content

Conversation

@xabbuh
Copy link
Member

@xabbuh xabbuh commented Nov 28, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

Our test suite is currently failing because of what has been done in phpDocumentor/TypeResolver#237. The changed behaviour reminds me of #62388 look reasonable to me.

We need to decide if we want to bump the conflict (we cannot merge yet then as the latest tagged release is 1.12.0) or if we prefer to kind of implement the require logic for older versions of phpdocumentor/type-resolver ourselves in PhpDocTypeHelper::createType().

@xabbuh xabbuh requested a review from dunglas as a code owner November 28, 2025 10:39
@carsonbot carsonbot added this to the 6.4 milestone Nov 28, 2025
@xabbuh xabbuh force-pushed the phpdocumentor-type-resolver-237 branch from 17c1b34 to a01284b Compare November 28, 2025 10:48
@xabbuh xabbuh force-pushed the phpdocumentor-type-resolver-237 branch from a01284b to 8b3d215 Compare November 29, 2025 12:24
@xabbuh xabbuh changed the title [PropertyInfo] treat simple arrays as arrays not as lists [PropertyInfo] treat simple arrays of mixed values as arrays not as lists Nov 29, 2025
@xabbuh
Copy link
Member Author

xabbuh commented Nov 29, 2025

Status: Needs work

@xabbuh xabbuh force-pushed the phpdocumentor-type-resolver-237 branch from 21cbbb3 to 9f14fea Compare November 29, 2025 15:29
['mixedCollection', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, null, null)], null, null],
['collection', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, [new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)], new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTimeImmutable'))], null, null],
['nestedCollection', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, [new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)], new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, [new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)], new Type(Type::BUILTIN_TYPE_STRING, false)))], null, null],
['mixedCollection', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, [new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)], null)], null, null],
Copy link
Member Author

@xabbuh xabbuh Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mtarld and me talked about the failures during the hackathon. What we would have preferred as the solution is changing only this line to:

Suggested change
['mixedCollection', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, [new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)], null)], null, null],
['mixedCollection', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), null)], null, null],

That would mean not having to do any changes to prepare for the next phpdocumentor/type-resolver release and would also mean to be consistent with the other collection examples.

However, I found no way to distinguish mixed[] and array on released versions of that package meaning that we would have to bump constraint to have consistently passing tests.

Now, we can get the CI green by enforcing that the key type for arrays is int|string which is technically correct but may break existing code that relies on the key being null. I am not sure how we want to proceed here (if we are fine with the current solution, we should probably align the other extractors).

Copy link
Member Author

@xabbuh xabbuh Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like I found a way to restore the previous (even if not fully correct) behaviour, see #62577 as an alternative (now checking if we can achieve the same for 7.3+ when we use the TypeInfo component under the hood)

xabbuh added a commit to xabbuh/symfony that referenced this pull request Nov 29, 2025
This fixes the PropertyInfo component tests by treating `mixed[]` as an alias
of `array` sticking with the current behaviour even if that may technically
not be fully correct to avoid unwanted behaviour changes for existing applications
(see symfony#62546 (comment)).
xabbuh added a commit to xabbuh/symfony that referenced this pull request Nov 29, 2025
This fixes the PropertyInfo component tests by treating `mixed[]` as an alias
of `array` sticking with the current behaviour even if that may technically
not be fully correct to avoid unwanted behaviour changes for existing applications
(see symfony#62546 (comment)).
fabpot added a commit that referenced this pull request Nov 29, 2025
…tting types from docblocks (xabbuh)

This PR was merged into the 6.4 branch.

Discussion
----------

[PropertyInfo] treat `mixed[]` the same as `array` when getting types from docblocks

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | account for phpDocumentor/TypeResolver#237
| License       | MIT

This fixes the PropertyInfo component tests by treating `mixed[]` as an alias of `array` sticking with the current behaviour even if that may technically not be fully correct to avoid unwanted behaviour changes for existing applications (see #62546 (comment)).

Commits
-------

2d94451 treat `mixed[]` the same as `array` when getting types from docblocks
symfony-splitter pushed a commit to symfony/property-info that referenced this pull request Nov 29, 2025
This fixes the PropertyInfo component tests by treating `mixed[]` as an alias
of `array` sticking with the current behaviour even if that may technically
not be fully correct to avoid unwanted behaviour changes for existing applications
(see symfony/symfony#62546 (comment)).
@xabbuh
Copy link
Member Author

xabbuh commented Nov 29, 2025

closing as #62577 has been merged

@xabbuh xabbuh closed this Nov 29, 2025
@xabbuh xabbuh deleted the phpdocumentor-type-resolver-237 branch November 29, 2025 18:54
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.

3 participants