Skip to content

Commit

Permalink
Fix error raised by PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Oct 29, 2018
1 parent 7c76ba5 commit 6693f56
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ErrorTypesParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ private function convertErrorConstants(string $expression): string
return $errorConstant[0];
}, $expression);

if (null === $output) {
throw new \InvalidArgumentException('Unable to parse error types string: ' . $expression);
}

return $output;
}

Expand Down
8 changes: 8 additions & 0 deletions test/ErrorTypesParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ public function test_error_types_parser_throws_exception_for_unwanted_values()
$this->expectException(\InvalidArgumentException::class);
$ex->parse();
}

public function test_error_types_parser_throws_exception_for_unparsable_values()
{
$ex = new ErrorTypesParser('something-wrong');

$this->expectException(\InvalidArgumentException::class);
$ex->parse();
}
}

0 comments on commit 6693f56

Please sign in to comment.