-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Bug report
mt_rand returns a random number. The second if statement in the below is therefore not redundant. However PHPStan reports Comparison operation ">" between int<4, max> and 3 is always true..
<?php
if (mt_rand(0,10) > 3) {
echo 'Fizz';
if (mt_rand(0,10) > 3) {
echo 'Buzz';
}
}
echo "\n";Code snippet that reproduces the problem
https://phpstan.org/r/43bf48f4-947d-4d96-9fc1-33e25fde3adb
Expected output
No output expected. Arguably, PHPStan should never assume that functions return the same value when called twice with the same arguments, but as this is a standard-library random number function it seems particularly important.
Reactions are currently unavailable