Skip to content
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

Fix PHPStan build #162

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
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
@@ -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
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
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();
}
}