Skip to content

Array shape not properly inferred in version 1.4 #6383

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

Closed
Khartir opened this issue Jan 17, 2022 · 2 comments
Closed

Array shape not properly inferred in version 1.4 #6383

Khartir opened this issue Jan 17, 2022 · 2 comments
Labels
Milestone

Comments

@Khartir
Copy link

Khartir commented Jan 17, 2022

Bug report

The shape of a locally defined array is not properly inferred in version 1.4. This worked before in 1.3.3.

Code snippet that reproduces the problem

https://phpstan.org/r/c0dbbff6-e525-4a9c-a466-3453f44ebb75

Expected output

No errors

Did PHPStan help you today? Did it make you happy in any way?

I'm currently upgrading to 1.4 and once again phpstan finds more errors in my code.

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Mar 10, 2022
@phpstan-bot
Copy link
Contributor

@Khartir After the latest commit in 1.6.x, PHPStan now reports different result with your code snippet:

@@ @@
-22: Parameter #2 $haystack of function in_array expects array, array<int, string>|bool|string given.
+No errors

@github-actions
Copy link

github-actions bot commented May 4, 2022

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 May 4, 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

3 participants