Skip to content

Commit 6f653bb

Browse files
staabmondrejmirtes
authored andcommitted
Added regression test
1 parent 0799527 commit 6f653bb

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/PHPStan/Rules/Comparison/MatchExpressionRuleTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,4 +552,13 @@ public function testBug11246(): void
552552
$this->analyse([__DIR__ . '/data/bug-11246.php'], []);
553553
}
554554

555+
public function testBug9879(): void
556+
{
557+
if (PHP_VERSION_ID < 80100) {
558+
$this->markTestSkipped('Test requires PHP 8.1.');
559+
}
560+
561+
$this->analyse([__DIR__ . '/data/bug-9879.php'], []);
562+
}
563+
555564
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php declare(strict_types = 1); // lint >= 8.1
2+
3+
namespace Bug9879;
4+
5+
final class A {
6+
public function test(): void
7+
{
8+
for($idx = 0; $idx < 6; $idx += 1) {
9+
match($idx % 3) {
10+
0 => 1,
11+
1 => 2,
12+
2 => 0,
13+
};
14+
}
15+
16+
}
17+
18+
}

0 commit comments

Comments
 (0)