Skip to content

Commit fc2c05c

Browse files
committed
Ensure variable unpacking is not handled as a first class callable
1 parent 70ce334 commit fc2c05c

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

WordPress/AbstractFunctionParameterSniff.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,13 @@ public function is_targetted_token( $stackPtr ) {
106106
return false;
107107
}
108108

109-
$nextNonEmpty = $this->phpcsFile->findNext(
110-
Tokens::$emptyTokens,
111-
( $next + 1 ),
112-
null,
113-
true
114-
);
115-
116109
// First class callable.
117-
if ( $nextNonEmpty && \T_ELLIPSIS === $this->tokens[ $nextNonEmpty ]['code'] ) {
118-
return false;
110+
$firstNonEmpty = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $next + 1 ), null, true );
111+
if ( $firstNonEmpty && \T_ELLIPSIS === $this->tokens[ $firstNonEmpty ]['code'] ) {
112+
$secondNonEmpty = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $firstNonEmpty + 1 ), null, true );
113+
if ( ! $secondNonEmpty || \T_CLOSE_PARENTHESIS === $this->tokens[ $secondNonEmpty ]['code'] ) {
114+
return false;
115+
}
119116
}
120117

121118
return true;

0 commit comments

Comments
 (0)