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 f390b54 commit 9a6e12cCopy full SHA for 9a6e12c
tests/PHPStan/Analyser/nsrt/bug-12173.php
@@ -0,0 +1,19 @@
1
+<?php // lint >= 7.4
2
+
3
+namespace Bug12173;
4
5
+use function PHPStan\Testing\assertType;
6
7
+class HelloWorld
8
+{
9
+ public function parse(string $string): void
10
+ {
11
+ $regex = '#.*(?<fruit>(apple|orange)).*#';
12
13
+ if (preg_match($regex, $string, $matches) !== 1) {
14
+ throw new \Exception('Invalid input');
15
+ }
16
17
+ assertType("'apple'|'orange'", $matches['fruit']);;
18
19
+}
0 commit comments