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 9ae7517 commit 113c0cfCopy full SHA for 113c0cf
tests/PHPStan/Rules/Pure/PureFunctionRuleTest.php
@@ -174,4 +174,10 @@ public function testBug12224(): void
174
]);
175
}
176
177
+ #[RequiresPhp('>= 8.1')]
178
+ public function testBug13201(): void
179
+ {
180
+ $this->analyse([__DIR__ . '/data/bug-13201.php'], []);
181
+ }
182
+
183
tests/PHPStan/Rules/Pure/data/bug-13201.php
@@ -0,0 +1,19 @@
1
+<?php // lint >= 8.1
2
3
+namespace PHPStan\Rules\Pure\data\Bug13201;
4
5
+enum Foo: string
6
+{
7
8
+ case Bar = 'bar';
9
+ case Unknown = 'unknown';
10
11
+}
12
13
+/**
14
+ * @pure
15
+ */
16
+function createWithFallback(string $type): Foo
17
18
+ return Foo::tryFrom($type) ?? Foo::Unknown;
19
0 commit comments