Skip to content
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

Array shape is forgotten by adding some conditionals. #8017

Closed
bendavies opened this issue Sep 16, 2022 · 4 comments
Closed

Array shape is forgotten by adding some conditionals. #8017

bendavies opened this issue Sep 16, 2022 · 4 comments
Labels

Comments

@bendavies
Copy link

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!

@VincentLanglet
Copy link
Contributor

Too me it's a duplicate of #7963 and #8004

Since the array_shape is very complex, it is simplified by phpstan.

@phpstan-bot
Copy link
Contributor

@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

@VincentLanglet
Copy link
Contributor

VincentLanglet commented Sep 19, 2022

Seems like it's solved by phpstan/phpstan-src@43d3652...bd57fc5

Do you want to add a regression test @ondrejmirtes @rvanvelzen ? (I can do it if the test if wanted)

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants