Closed
Description
Describe the bug
PHPCS throws a fatal error when the user passes an invalid generator.
To reproduce
Steps to reproduce the behavior:
- Run
phpcs test.php --generator=InvalidGenerator --standard=Generic
- See the error message displayed
$ phpcs test.php --generator=InvalidGenerator --standard=Generic
PHP Fatal error: Uncaught Error: Class "PHP_CodeSniffer\Generators\InvalidGenerator" not found in src/Runner.php:98
Stack trace:
#0 bin/phpcs(14): PHP_CodeSniffer\Runner->runPHPCS()
#1 {main}
thrown in src/Runner.php on line 98
Expected behavior
PHPCS should display a user-friendly error message informing the user that the generator does not exist and potentially listing the available generators.
Please confirm
- I have searched the issue list and am not opening a duplicate issue.
- I have read the Contribution Guidelines and this is not a support question.
- I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
- I have verified the issue still exists in the
master
branch of PHP_CodeSniffer.