Skip to content

Commit 7cb4901

Browse files
committed
Regression test
Closes phpstan/phpstan#8938
1 parent f882eff commit 7cb4901

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Diff for: tests/PHPStan/Rules/Comparison/NumberComparisonOperatorsConstantConditionRuleTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,10 @@ public function testBug7075(): void
207207
$this->analyse([__DIR__ . '/data/bug-7075.php'], []);
208208
}
209209

210+
public function testBug8938(): void
211+
{
212+
$this->treatPhpDocTypesAsCertain = true;
213+
$this->analyse([__DIR__ . '/data/bug-8938.php'], []);
214+
}
215+
210216
}

Diff for: tests/PHPStan/Rules/Comparison/data/bug-8938.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Bug8938;
4+
5+
class HelloWorld
6+
{
7+
public function processData(string $data): string
8+
{
9+
$returnValue = '';
10+
while (strlen($data) > 0) {
11+
$firstChar = substr($data, 0, 1);
12+
$data = substr($data, 1);
13+
$returnValue = $returnValue . $firstChar;
14+
}
15+
return $returnValue;
16+
}
17+
}

0 commit comments

Comments
 (0)