Closed neerolyte closed 2 years ago
Describe the bug
Some PHP syntax errors can cause PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff to loop forever.
PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff
Code sample
<?php class Foo implements Interface {}
Custom ruleset N/A
To reproduce Steps to reproduce the behavior:
test.php
./vendor/bin/phpcs test.php --standard=PSR12 -vvv
Process token 1: T_CLASS => class Processing PHP_CodeSniffer\Standards\PSR12\Sniffs\Classes\OpeningBraceSpaceSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\PSR12\Sniffs\Classes\ClosingBraceSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseKeywordSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\PSR2\Sniffs\Classes\ClassDeclarationSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\ScopeClosingBraceSniff... DONE in 0 seconds Process token 2: T_WHITESPACE => · Processing PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\SuperfluousWhitespaceSniff... DONE in 0 seconds Process token 3: T_STRING => Foo Processing PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\UpperCaseConstantNameSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\Generic\Sniffs\Functions\FunctionCallArgumentSpacingSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\FunctionCallSignatureSniff... DONE in 0 seconds Process token 4: T_WHITESPACE => · Processing PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\SuperfluousWhitespaceSniff... DONE in 0 seconds Process token 5: T_IMPLEMENTS => implements Processing PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseKeywordSniff... DONE in 0 seconds Process token 6: T_WHITESPACE => · Processing PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\SuperfluousWhitespaceSniff... DONE in 0 seconds Process token 7: T_INTERFACE => Interface Processing PHP_CodeSniffer\Standards\PSR12\Sniffs\Classes\OpeningBraceSpaceSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\PSR12\Sniffs\Classes\ClosingBraceSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff... DONE in 0 seconds Processing PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff...
Expected behavior
The syntax error should be detected and not trigger an infinite loop
Versions (please complete the following information):
Additional context
This is working master. git bisect suggests 2b7bdb344d1527bcdb157e6ee60c6ce9fcca07ba was the fix.
master
git bisect
Was just looking at this and suspected it might have been that change. Thanks.
Describe the bug
Some PHP syntax errors can cause
PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff
to loop forever.Code sample
Custom ruleset N/A
To reproduce Steps to reproduce the behavior:
test.php
with the code sample above..../vendor/bin/phpcs test.php --standard=PSR12 -vvv
Expected behavior
The syntax error should be detected and not trigger an infinite loop
Versions (please complete the following information):
Additional context