Skip to content

Commit 9a6e12c

Browse files
staabmondrejmirtes
authored andcommitted
Added regression test
1 parent f390b54 commit 9a6e12c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)