Skip to content

Commit fac96bf

Browse files
committed
Regression test
Closes phpstan/phpstan#9850
1 parent fe595cb commit fac96bf

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

tests/PHPStan/Rules/Comparison/NumberComparisonOperatorsConstantConditionRuleTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,10 @@ public function testBug6642(): void
240240
$this->analyse([__DIR__ . '/data/bug-6642.php'], []);
241241
}
242242

243+
public function testBug9850(): void
244+
{
245+
$this->treatPhpDocTypesAsCertain = true;
246+
$this->analyse([__DIR__ . '/data/bug-9850.php'], []);
247+
}
248+
243249
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Bug9850;
4+
5+
class CsvImport
6+
{
7+
public function imporContent(): void
8+
{
9+
$lineCount = 0;
10+
$inputArray = ['a', 'b', 'c', 'd', 'e', 'f'];
11+
$datasets = [];
12+
foreach ($inputArray as $bnn3Line) {
13+
++$lineCount;
14+
if ($lineCount === 1) {
15+
// special treatment for line number 1
16+
} else {
17+
$datasets[] = $bnn3Line;
18+
if (count($datasets) >= 3) {
19+
// todo
20+
}
21+
}
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)