Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Try to run the phpcs using the PHP_CodeSniffer 2.0.0RC1 and Coder 2.2 and 2.x-dev but it throws an error:
PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Class PHP_CodeSniffer_CommentParser_ClassCommentParser not found' in /<custom_path>/coder/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php:13
Stack trace:
#0 /usr/share/pear/PHP/CodeSniffer.php(1179): include_once()
#1 /usr/share/pear/PHP/CodeSniffer.php(557): PHP_CodeSniffer->registerSniffs(Array, Array)
#2 /usr/share/pear/PHP/CodeSniffer/CLI.php(753): PHP_CodeSniffer->initStandard(Array, Array)
#3 /usr/share/pear/PHP/CodeSniffer/CLI.php(91): PHP_CodeSniffer_CLI->process()
#4 /usr/bin/phpcs(25): PHP_CodeSniffer_CLI->runphpcs()
#5 {main}
thrown in /<custom_path>/coder/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php on line 13
Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Class PHP_CodeSniffer_CommentParser_ClassCommentParser not found' in /<custom_path>/coder/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php on line 13
PHP_CodeSniffer_Exception: Class PHP_CodeSniffer_CommentParser_ClassCommentParser not found in /<custom_path>/coder/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php on line 13
Call Stack:
0.0002 226512 1. {main}() /usr/bin/phpcs:0
0.0141 1367320 2. PHP_CodeSniffer_CLI->runphpcs() /usr/bin/phpcs:25
0.0146 1423888 3. PHP_CodeSniffer_CLI->process() /usr/share/pear/PHP/CodeSniffer/CLI.php:91
0.0159 1434456 4. PHP_CodeSniffer->initStandard() /usr/share/pear/PHP/CodeSniffer/CLI.php:753
0.0702 1487424 5. PHP_CodeSniffer->registerSniffs() /usr/share/pear/PHP/CodeSniffer.php:557
0.0867 2621296 6. include_once('/<custom_path>/coder/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php') /usr/share/pear/PHP/CodeSniffer.php:1179
Tested with PHP_CodeSniffer 1.5.4 and works perfect.
Comments
Comment #1
klausiCoder 7.x-2.x is only compatible with PHPCS 1.x. You need to use 8.x-2.x for PHPCS 2.x.
Comment #2
tvl CreditAttribution: tvl commentedThanks for the clarification.