Skip to content

Commit

Permalink
Added regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and ondrejmirtes committed Jun 30, 2024
1 parent 0799527 commit 6f653bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/PHPStan/Rules/Comparison/MatchExpressionRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,4 +552,13 @@ public function testBug11246(): void
$this->analyse([__DIR__ . '/data/bug-11246.php'], []);
}

public function testBug9879(): void
{
if (PHP_VERSION_ID < 80100) {
$this->markTestSkipped('Test requires PHP 8.1.');
}

$this->analyse([__DIR__ . '/data/bug-9879.php'], []);
}

}
18 changes: 18 additions & 0 deletions tests/PHPStan/Rules/Comparison/data/bug-9879.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php declare(strict_types = 1); // lint >= 8.1

namespace Bug9879;

final class A {
public function test(): void
{
for($idx = 0; $idx < 6; $idx += 1) {
match($idx % 3) {
0 => 1,
1 => 2,
2 => 0,
};
}

}

}

0 comments on commit 6f653bb

Please sign in to comment.