-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Bug report
Version is 0.12.0
It appears that bounds for the derived variable $i has the bounds applied from the for loop variables.
Code snippet that reproduces the problem
<?php
declare(strict_types=1);
class MyClass{
public $t = 0;
public function test() : array{
$result = [];
for($xx = 0; $xx <= 2; ++$xx){
for($zz = 0; $zz <= 2; ++$zz){
$i = $zz * 3 + $xx;
if($i === 4){
continue; //center chunk
}
$result[$i] = true;
}
}
return $result;
}
}https://phpstan.org/r/a1836aad-4d1e-42df-ad12-f8772c4b2ffb
Expected output
No errors (on level 4, at least).
Reactions are currently unavailable