Skip to content

Conversation

@matijn-made
Copy link
Contributor

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

While using latest Symfony Live Components we detected that simple array docblocks (bool[]) were parsed as list type instead of array type. I couldn't find any documentation on what's officially known as list vs. array, as PHP does not really distinguish between list and array. It is my understanding hower that using bool[] means array. PHPstan docs also mentions Type[] being array (https://phpstan.org/writing-php-code/phpdoc-types)
I've added a few tests to verify the new behaviour.

I also added an extra check for which key types are supported for arrays (with tests). I'm not sure if these should go in this PR, or if I should add a second PR for this.

@carsonbot carsonbot added this to the 7.3 milestone Nov 13, 2025
@carsonbot carsonbot changed the title Simple array should be array type Simple array should be array type Nov 13, 2025
@matijn-made matijn-made changed the title Simple array should be array type [TypeInfo] Simple array should be array type Nov 13, 2025
@stof
Copy link
Member

stof commented Nov 14, 2025

this change is legitimate. None of the static analysis tools treat bool[] as meaning a list.

@xabbuh
Copy link
Member

xabbuh commented Nov 14, 2025

The tests need some love though.

@carsonbot carsonbot changed the title [TypeInfo] Simple array should be array type Simple array should be array type Nov 14, 2025
@matijn-made matijn-made requested a review from dunglas as a code owner November 14, 2025 12:15
@matijn-made matijn-made marked this pull request as draft November 14, 2025 12:21
@matijn-made matijn-made marked this pull request as ready for review November 16, 2025 10:48
@matijn-made
Copy link
Contributor Author

Thank you all for your comments. I have addressed them in the latest commit.
The tests are also updated and green.
The low//high deps tests are failing because they install different version of TypeInfo instead of using the changes in this PR. Is it oke for these unit tests to fail now?

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Nov 16, 2025

The low-deps should be fixed by bumping the minimum version in framework-bundle

@matijn-made
Copy link
Contributor Author

The low-deps should be fixed by bumping the minimum version in framework-bundle

Do you mean bump version in composer.json? I'm not sure which version should go there, since the code is in this PR?
Also, Framework bundle tests are fine in low-deps, it's the PropertyInfo component tests which fail

@nicolas-grekas
Copy link
Member

ah right, so property-info should bump to type-info ^7.3.8|^7.4

@matijn-made matijn-made force-pushed the feature/typeinfo-array-type branch from dbfb83b to 6755acc Compare November 16, 2025 12:48
@carsonbot carsonbot changed the title Simple array should be array type [TypeInfo] Simple array should be array type Nov 16, 2025
@matijn-made matijn-made force-pushed the feature/typeinfo-array-type branch from 6755acc to 2959a53 Compare November 16, 2025 12:51
@nicolas-grekas nicolas-grekas force-pushed the feature/typeinfo-array-type branch from 6c519e7 to 43cf70f Compare December 5, 2025 13:52
@nicolas-grekas
Copy link
Member

Thank you @matijn-made.

@nicolas-grekas nicolas-grekas merged commit 55186a7 into symfony:7.3 Dec 5, 2025
4 of 11 checks passed
This was referenced Dec 7, 2025
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.

6 participants