You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$values = $sortedValues = [0.5, 1, 2, 0.8, 0.4];
sort($sortedValues);
$expected = $sortedValues[2] + 0.05; // note here that we get the value from the sorted array
foreach (array_fill(0, 5, null) as $index => $null) {
$success = $values[$index] < $expected;
}
Actual output
The following error (which is wrong):
Comparison operation "<" between 0.4|0.5|0.8|1|2 and 2.05 is always true.
Expected output
The output should be fine and not throw an error since the sorted array 3rd element is 0.8, which is not 2.05 but 1.3.
Did PHPStan help you today? Did it make you happy in any way?
Yes of course :)
The text was updated successfully, but these errors were encountered:
Bug report
Version: 1.4.2
Issue: Comparison does not work correctly with sorted arrays
Given the following code block I got the following error message.
Code snippet that reproduces the problem
(See at: https://phpstan.org/r/5fadc22b-916a-4cdd-9752-45d0fbbeb576)
Actual output
The following error (which is wrong):
Expected output
The output should be fine and not throw an error since the sorted array 3rd element is 0.8, which is not 2.05 but 1.3.
Did PHPStan help you today? Did it make you happy in any way?
Yes of course :)
The text was updated successfully, but these errors were encountered: