Skip to content

Commit 6037f78

Browse files
committed
Regression test
Closes phpstan/phpstan#12716
1 parent 0df0c6f commit 6037f78

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/PHPStan/Rules/Comparison/NumberComparisonOperatorsConstantConditionRuleTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,4 +246,10 @@ public function testBug9850(): void
246246
$this->analyse([__DIR__ . '/data/bug-9850.php'], []);
247247
}
248248

249+
public function testBug12716(): void
250+
{
251+
$this->treatPhpDocTypesAsCertain = true;
252+
$this->analyse([__DIR__ . '/data/bug-12716.php'], []);
253+
}
254+
249255
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Bug12716;
4+
5+
function (): void {
6+
$items = [];
7+
$a = function () use (&$items) {
8+
$x = 'a';
9+
$items[] = $x;
10+
if (count($items) >= 10) {
11+
var_dump(count($items));
12+
$items = [];
13+
}
14+
};
15+
$i = 0;
16+
while ($i++ <= 100) {
17+
$a();
18+
}
19+
};

0 commit comments

Comments
 (0)