-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[TypeInfo] Simple array should be array type #62388
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
[TypeInfo] Simple array should be array type #62388
Conversation
|
this change is legitimate. None of the static analysis tools treat |
|
The tests need some love though. |
src/Symfony/Component/TypeInfo/Tests/TypeResolver/StringTypeResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/TypeInfo/Tests/TypeResolver/StringTypeResolverTest.php
Outdated
Show resolved
Hide resolved
|
Thank you all for your comments. I have addressed them in the latest commit. |
|
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? |
|
ah right, so property-info should bump to type-info |
dbfb83b to
6755acc
Compare
6755acc to
2959a53
Compare
src/Symfony/Component/JsonStreamer/Tests/Fixtures/Model/DummyWithArray.php
Outdated
Show resolved
Hide resolved
2959a53 to
76a28a1
Compare
src/Symfony/Component/JsonStreamer/Tests/JsonStreamWriterTest.php
Outdated
Show resolved
Hide resolved
e776c78 to
6c519e7
Compare
6c519e7 to
43cf70f
Compare
|
Thank you @matijn-made. |
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 usingbool[]means array. PHPstan docs also mentionsType[]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.