Open
Description
Is your feature request related to a problem?
PHPCS throws a fatal error when the user passes an invalid filter:
$ bin/phpcs --filter=InvalidFilter .
PHP Fatal error: Uncaught Error: Class "\PHP_CodeSniffer\Filters\InvalidFilter" not found in src/Files/FileList.php:90
Stack trace:
#0 src/Runner.php(402): PHP_CodeSniffer\Files\FileList->__construct()
#1 src/Runner.php(120): PHP_CodeSniffer\Runner->run()
#2 bin/phpcs(14): PHP_CodeSniffer\Runner->runPHPCS()
#3 {main}
thrown in src/Files/FileList.php on line 90
Describe the solution you'd like
PHPCS should display a user-friendly error message informing the user that the filter does not exist and potentially list the available filters.
Additional context
Similar issue but for generators: #709.
While working on this issue, it is probably worth testing the other PHPCS CLI arguments to see if there are more arguments that cause a fatal error when passed invalid input and address them as well.
- I have read the Contribution Guidelines and this is not a support question.
- I intend to create a pull request to implement this feature.