We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8bb2a20 commit 76045f5Copy full SHA for 76045f5
tests/PHPStan/Rules/Comparison/MatchExpressionRuleTest.php
@@ -435,4 +435,11 @@ public function testPropertyHooks(): void
435
]);
436
}
437
438
+
439
+ #[RequiresPhp('>= 8.0')]
440
+ public function testBug13048(): void
441
+ {
442
+ $this->analyse([__DIR__ . '/data/bug-13048.php'], []);
443
+ }
444
445
tests/PHPStan/Rules/Comparison/data/bug-13048.php
@@ -0,0 +1,22 @@
1
+<?php // lint >= 8.0
2
3
+namespace Bug11852;
4
5
+enum IndexBy {
6
+ case A;
7
+ case B;
8
+}
9
10
+/**
11
+ * @template T of IndexBy|null
12
+ * @param T $indexBy
13
+ * @return (T is null ? null : string)
14
+ */
15
+function run(?IndexBy $indexBy = null): ?string
16
+{
17
+ return match ($indexBy) {
18
+ IndexBy::A => 'by A',
19
+ IndexBy::B => 'by B',
20
+ null => null,
21
+ };
22
0 commit comments