Initial implementation of unsealed array shapes#5501
Initial implementation of unsealed array shapes#5501ondrejmirtes wants to merge 12 commits into2.2.xfrom
Conversation
|
You've opened the pull request against the latest branch 2.2.x. PHPStan 2.2 is not going to be released for months. If your code is relevant on 2.1.x and you want it to be released sooner, please rebase your pull request and change its target to 2.1.x. |
|
Could you explain why unsealed arrays are "flawed"? |
|
@mnapoli There are two meanings of "flawed" I'm referring to.
So this PR is trying to address these problems. With bleeding edge enabled, |
|
Also, a big advantage of these changes is that array shape intersections are now possible! |
|
This can also be incredibly helpful with sealed arrays when they are defined elsewhere. Imagine, you have |
|
Thanks for the details, I see! |
Array shapes like `array{a: int}` in PHPDocs are only sealed in Bleeding Edge.
Without Bleeding edge, the goal is to match the current flawed behaviour
as close as possible.
Array shapes like
array{a: int}in PHPDocs are only sealed in Bleeding Edge.Without Bleeding edge, the goal is to match the current flawed behaviour as close as possible.
Closes phpstan/phpstan#13565
Closes phpstan/phpstan#8438
Closes phpstan/phpstan#11494
Closes phpstan/phpstan#12110
Closes phpstan/phpstan#14032