aik099 / CodingStandard

The PHP_CodeSniffer coding standard I'm using on all of my projects
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Fatal Error on PHP 7.4 #108

Closed aik099 closed 10 months ago

aik099 commented 1 year ago

When standard executed using PHP_CodeSniffer 3.5.7 using PHP 7.4, then I got this Fatal Error:

phpcs: PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function CodingStandard\Sniffs\Commenting\TypeCommentStructure::__construct(), 0 passed in /Users/alex/.composer/vendor/squizlabs/php_codesniffer/src/Ruleset.php on line 1209 and exactly 2 expected in /Volumes/web/g/console-helpers/svn-buddy/vendor/aik099/coding-standard/CodingStandard/Sniffs/Commenting/TypeCommentSniff.php:608 Stack trace: #0 /Users/alex/.composer/vendor/squizlabs/php_codesniffer/src/Ruleset.php(1209): CodingStandard\Sniffs\Commenting\TypeCommentStructure->__construct() #1 /Users/alex/.composer/vendor/squizlabs/php_codesniffer/src/Ruleset.php(218): PHP_CodeSniffer\Ruleset->populateTokenListeners() #2 /Users/alex/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(332): PHP_CodeSniffer\Ruleset->__construct(Object(PHP_CodeSniffer\Config)) #3 /Users/alex/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(70): PHP_CodeSniffer\Runner->init() #4 /Users/alex/.composer/vendor/squizlabs/php_codesniffer/bin/phpcs(17): PHP_CodeSniffer\Runne in /Volumes/web/g/console-helpers/svn-buddy/vendor/aik099/coding-standard/CodingStandard/Sniffs/Commenting/TypeCommentSniff.php on line 608  

It seems, that PHP_CodeSniffer treats the TypeCommentStructure class as a sniff and tries to execute it. Likely this was happening on the PHP 7.2 as well, but in there PHP haven't complained about invoking class without arguments.

aik099 commented 10 months ago

The problem was happening only on the PHP_CodeSniffer 3.5.6 version. Please update to next available version.