Skip to content

Commit 6693f56

Browse files
committed
Fix error raised by PHPStan
1 parent 7c76ba5 commit 6693f56

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/ErrorTypesParser.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ private function convertErrorConstants(string $expression): string
5555
return $errorConstant[0];
5656
}, $expression);
5757

58+
if (null === $output) {
59+
throw new \InvalidArgumentException('Unable to parse error types string: ' . $expression);
60+
}
61+
5862
return $output;
5963
}
6064

test/ErrorTypesParserTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,12 @@ public function test_error_types_parser_throws_exception_for_unwanted_values()
2020
$this->expectException(\InvalidArgumentException::class);
2121
$ex->parse();
2222
}
23+
24+
public function test_error_types_parser_throws_exception_for_unparsable_values()
25+
{
26+
$ex = new ErrorTypesParser('something-wrong');
27+
28+
$this->expectException(\InvalidArgumentException::class);
29+
$ex->parse();
30+
}
2331
}

0 commit comments

Comments
 (0)