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

Generic properties are not properly refined by is_array checks in local usage #9939

Closed
stof opened this issue Sep 29, 2023 · 3 comments · Fixed by phpstan/phpstan-src#2652
Closed
Labels
Milestone

Comments

@stof
Copy link
Contributor

stof commented Sep 29, 2023

Bug report

When a variable contains a generic type for which the bound is a union involving string|array<string>, a is_array check does not properly refine the property as being a string in the else branch.

Code snippet that reproduces the problem

https://phpstan.org/r/f4025a6a-f221-436c-804b-ce7d15d9cab3

Expected output

No error should be reported.

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

No response

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src#2652

@thg2k
Copy link

thg2k commented Sep 29, 2023

@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 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants