Skip to content

Commit 781ce01

Browse files
committed
add origin bug test
1 parent 1ea5d36 commit 781ce01

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,34 @@ public function iterateRowColumnIndicesDecrementing(int $rows, int $columns, int
6969
}
7070
}
7171
}
72+
73+
class Bug12163
74+
{
75+
/**
76+
* @param non-negative-int $value
77+
* @return void
78+
*/
79+
private function checkNonNegative(int $value): void
80+
{
81+
sleep(1);
82+
}
83+
84+
public function iterateRowColumnIndices(int $rows, int $columns): void
85+
{
86+
if ($rows < 1 || $columns < 1) return;
87+
$size = $rows * $columns;
88+
89+
$rowIndex = 0;
90+
$columnIndex = 0;
91+
for ($i = 0; $i < $size; $i++) {
92+
$this->checkNonNegative($rowIndex);
93+
$this->checkNonNegative($columnIndex);
94+
if ($columnIndex < $columns) {
95+
$columnIndex++;
96+
} else {
97+
$columnIndex = 0;
98+
$rowIndex++;
99+
}
100+
}
101+
}
102+
}

0 commit comments

Comments
 (0)