Skip to content

Commit f131da8

Browse files
committed
AbstractClassRestrictionsSniff: fix inconsequential typo
The sniff looks for whitespace or a close curly at the end of a class declaration statement, but those don't end with a close curly, but with an open curly. As it would be rare for anyone not to have whitespace before the open curly (which is also enforced by WPCS), this bug will probably never have had any consequences in real life, as the `findNext()` would stop at the whitespace anyway. Having said that, I see quite a lot more wrong with the code in this abstract, but will leave that for the future abstract in PHPCSUtils to fix as spending lots of time on it here is not worth our time.
1 parent fd0493c commit f131da8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

WordPress/AbstractClassRestrictionsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function is_targetted_token( $stackPtr ) {
134134

135135
$nameEnd = ( $this->phpcsFile->findNext( array( \T_OPEN_PARENTHESIS, \T_WHITESPACE, \T_SEMICOLON, \T_CLOSE_PARENTHESIS, \T_CLOSE_TAG ), ( $stackPtr + 2 ) ) - 1 );
136136
} else {
137-
$nameEnd = ( $this->phpcsFile->findNext( array( \T_CLOSE_CURLY_BRACKET, \T_WHITESPACE ), ( $stackPtr + 2 ) ) - 1 );
137+
$nameEnd = ( $this->phpcsFile->findNext( array( \T_OPEN_CURLY_BRACKET, \T_WHITESPACE ), ( $stackPtr + 2 ) ) - 1 );
138138
}
139139

140140
if ( isset( $this->tokens[ $stackPtr + 2 ] ) && false !== $nameEnd ) {

0 commit comments

Comments
 (0)