Skip to content

Commit b979dbf

Browse files
VincentLangletondrejmirtes
authored andcommitted
Add non regression test
1 parent 1eead47 commit b979dbf

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ lint:
2020
--exclude tests/PHPStan/Rules/Names/data \
2121
--exclude tests/PHPStan/Rules/Operators/data/invalid-inc-dec.php \
2222
--exclude tests/PHPStan/Rules/Arrays/data/offset-access-without-dim-for-reading.php \
23+
--exclude tests/PHPStan/Rules/Classes/data/bug-11891.php \
2324
--exclude tests/PHPStan/Rules/Classes/data/bug-13768.php \
2425
--exclude tests/PHPStan/Rules/Classes/data/duplicate-declarations.php \
2526
--exclude tests/PHPStan/Rules/Classes/data/duplicate-enum-cases.php \

tests/PHPStan/Rules/Classes/EnumSanityRuleTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,15 @@ public function testBug13768(): void
179179
]);
180180
}
181181

182+
#[RequiresPhp('>= 8.1')]
183+
public function testBug11891(): void
184+
{
185+
$this->analyse([__DIR__ . '/data/bug-11891.php'], [
186+
[
187+
'Enum Bug11891\test has duplicate value 42 for cases A, B.',
188+
5,
189+
],
190+
]);
191+
}
192+
182193
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php // lint >= 8.1
2+
3+
namespace Bug11891;
4+
5+
enum test:int {
6+
case A = 42;
7+
case B = self::A->value;
8+
};

0 commit comments

Comments
 (0)