Skip to content

Commit

Permalink
added regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 21, 2022
1 parent be4afec commit 085713b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Expand Up @@ -122,4 +122,10 @@ public function testBug8076(): void
$this->analyse([__DIR__ . '/data/bug-8076.php'], []);
}

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

}
18 changes: 18 additions & 0 deletions tests/PHPStan/Rules/Comparison/data/bug-8562.php
@@ -0,0 +1,18 @@
<?php declare(strict_types = 1);

namespace Bug8562;

/**
* @param array<int, bool> $a
*/
function a(array $a): void {
$l = (string) array_key_last($a);
$s = substr($l, 0, 2);
if ($s === '') {
;
} else {
var_dump($s);
}
}


0 comments on commit 085713b

Please sign in to comment.