Skip to content

Fix PHPStan build #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
},
"scripts": {
"phpstan": "vendor/bin/phpstan analyse src test --level 7 -c phpstan.neon",
"phpstan": "vendor/bin/phpstan analyse",
"cs-check": "vendor/bin/php-cs-fixer fix --verbose --diff --dry-run",
"cs-fix": "vendor/bin/php-cs-fixer fix --verbose --diff"
},
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
parameters:
level: 7
paths:
- src/
- test/
ignoreErrors:
- '/Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent/'
- '/Call to an undefined method Symfony\\Component\\Console\\Event\\ConsoleEvent::getExitCode\(\)\./'
Expand Down
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();
}
}