phpstan
phpstan copied to clipboard
Array shape is forgotten by adding some conditionals.
Bug report
It seems phpstan is "forgetting" the shape of an array by just adding 2 conditional statements.
Code snippet that reproduces the problem
https://phpstan.org/r/3412d834-a20f-4968-aeae-06b6b07e4463
Expected output
Array shape is not forgotten.
Did PHPStan help you today? Did it make you happy in any way?
1.8.5 caught some more issues to fix in our product!
Too me it's a duplicate of https://github.com/phpstan/phpstan/issues/7963 and https://github.com/phpstan/phpstan/issues/8004
Since the array_shape is very complex, it is simplified by phpstan.
@bendavies After the latest push in 1.8.x, PHPStan now reports different result with your code snippet:
@@ @@
5: Dumped type: int
-10: Dumped type: int|string|null
+10: Dumped type: int
Full report
| Line | Error |
|---|---|
| 5 | Dumped type: int |
| 10 | Dumped type: int |
Seems like it's solved by https://github.com/phpstan/phpstan-src/compare/43d365200bd6b11e9ab690049ffce2bcc46d9e86...bd57fc59f4737188ce750f607f42d85e6d4aec37
Do you want to add a regression test @ondrejmirtes @rvanvelzen ? (I can do it if the test if wanted)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.