PHP notice undefined array key AbstractPropertyConstantAndEnumCaseSpacing
kkmuffme opened this issue · comments
kkmuffme commented
Slevomat 8.14.1
Issue happened when running phpcbf
PHP Error for
Undefined array key "" in
Looks like $classPointer
is falsy in some cases.
Partial trace
#0 /path/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/AbstractPropertyConstantAndEnumCaseSpacing.php (87): PHP_CodeSniffer\Runner->handleErrors( $code = 2, $message = Undefined array key "", $file = /path/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/AbstractPropertyConstantAndEnumCaseSpacing.php, $line = 87 )
#1 /path/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/PropertySpacingSniff.php (63): SlevomatCodingStandard\Sniffs\Classes\AbstractPropertyConstantAndEnumCaseSpacing->process( $phpcsFile = PHP_CodeSniffer\Files\LocalFile Object, $pointer = 74 )
#2 /path/vendor/squizlabs/php_codesniffer/src/Files/File.php (498): SlevomatCodingStandard\Sniffs\Classes\PropertySpacingSniff->process( $phpcsFile = PHP_CodeSniffer\Files\LocalFile Object, $pointer = 72 )
I don't have any code samples to reproduce or any further details unfortunately, but just adding an isset before and handling it is enough to fix it
Jaroslav Hanslík commented
It's not possible to fix it without code sample.
github-actions commented
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.