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

Two following conditions with random_int and an inequality operator leads to false positive #4190

Closed
porebskk opened this issue Dec 5, 2020 · 2 comments
Labels

Comments

@porebskk
Copy link

porebskk commented Dec 5, 2020

Bug report

When two if-conditions are using random_int functions with the same arguments, then the second of the conditions is inheriting the limitations of the previous one.

Code snippet that reproduces the problem

https://phpstan.org/r/6b6afb0e-4fd8-43d0-8878-2e68fab50722

Current false positive

Comparison operation "<=" between int<6, 10> and 5 is always false.

Expected output

No issue should be detected.

@porebskk porebskk changed the title Two following random_int function calls with the same arguments lead to false positive Two following conditions with random_int and an inequality operator leads to false positive Dec 5, 2020
@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@f36fa71

@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 Apr 29, 2021
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

2 participants