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

Detect array_rand second parameter #9803

Closed
ghost opened this issue Aug 26, 2023 · 3 comments
Closed

Detect array_rand second parameter #9803

ghost opened this issue Aug 26, 2023 · 3 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Aug 26, 2023

Bug report

It seems that PHPStan is unable to detect that I've already checked that the second parameter is NOT one, thus there is no way for the array_rand function to actually return an int.

Code snippet that reproduces the problem

https://phpstan.org/r/dd4af264-54b9-4c5c-a674-7dad5c089d5f

Expected output

I expected no error.

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

PHPStan helps me everyday write awesome open source code, thank you!

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Aug 30, 2023
@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src#2633

@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 30, 2023
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

1 participant