Skip to content

Commit 4e8e644

Browse files
committed
Update bug-12163.php
1 parent a7b5c77 commit 4e8e644

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/PHPStan/Analyser/nsrt/bug-12163.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,25 @@ public function iterateRowColumnIndicesDecrementing(int $rows, int $columns): vo
4747
}
4848
}
4949
}
50+
51+
class Test3
52+
{
53+
/**
54+
* @param int<0, 30> $columnIndex
55+
*/
56+
public function iterateRowColumnIndicesDecrementing(int $rows, int $columns, int $columnIndex): void
57+
{
58+
if ($rows < 1 || $columns < 1) return;
59+
$size = $rows * $columns;
60+
61+
for ($i = 0; $i < $size; $i++) {
62+
assertType('int<min, 30>', $columnIndex);
63+
if ($columnIndex < 3) {
64+
$columnIndex--;
65+
} else {
66+
$columnIndex = 0;
67+
}
68+
assertType('int<min, 1>', $columnIndex);
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)