Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 25, 2023
1 parent f882eff commit 7cb4901
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,10 @@ public function testBug7075(): void
$this->analyse([__DIR__ . '/data/bug-7075.php'], []);
}

public function testBug8938(): void
{
$this->treatPhpDocTypesAsCertain = true;
$this->analyse([__DIR__ . '/data/bug-8938.php'], []);
}

}
17 changes: 17 additions & 0 deletions tests/PHPStan/Rules/Comparison/data/bug-8938.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Bug8938;

class HelloWorld
{
public function processData(string $data): string
{
$returnValue = '';
while (strlen($data) > 0) {
$firstChar = substr($data, 0, 1);
$data = substr($data, 1);
$returnValue = $returnValue . $firstChar;
}
return $returnValue;
}
}

0 comments on commit 7cb4901

Please sign in to comment.