Skip to content

Commit af4f80d

Browse files
committed
Performance/FetchingRemoteData: remove redundant method
This method was introduced in PR 855 as a temporary stop-gap to allow for supporting PHP 8.1+ first class callables. As of WPCS 3.2.0, first class callables are no longer passed to the `process_no_parameters()` method, but to the new dedicated `process_first_class_callable()` method, so this method is no longer needed.
1 parent a8b3078 commit af4f80d

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

WordPressVIPMinimum/Sniffs/Performance/FetchingRemoteDataSniff.php

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -94,40 +94,6 @@ public function process_parameters( $stackPtr, $group_name, $matched_content, $p
9494
}
9595
}
9696

97-
/**
98-
* Process the function if no parameters were found.
99-
*
100-
* {@internal This method is only needed for handling PHP 8.1+ first class callables on WPCS < 3.2.0.
101-
* Once the minimum supported WPCS is 3.2.0 or higher, this method should be removed.}
102-
*
103-
* @param int $stackPtr The position of the current token in the stack.
104-
* @param string $group_name The name of the group which was matched.
105-
* @param string $matched_content The token content (function name) which was matched
106-
* in lowercase.
107-
*
108-
* @return void
109-
*/
110-
public function process_no_parameters( $stackPtr, $group_name, $matched_content ) {
111-
// Check if this is a first class callable.
112-
$next = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
113-
if ( $next === false
114-
|| $this->tokens[ $next ]['code'] !== T_OPEN_PARENTHESIS
115-
|| isset( $this->tokens[ $next ]['parenthesis_closer'] ) === false
116-
) {
117-
// Live coding/parse error. Ignore.
118-
return;
119-
}
120-
121-
// First class callable.
122-
$firstNonEmpty = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $next + 1 ), null, true );
123-
if ( $this->tokens[ $firstNonEmpty ]['code'] === T_ELLIPSIS ) {
124-
$secondNonEmpty = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $firstNonEmpty + 1 ), null, true );
125-
if ( $this->tokens[ $secondNonEmpty ]['code'] === T_CLOSE_PARENTHESIS ) {
126-
$this->add_contents_unknown_warning( $stackPtr, [ $matched_content ] );
127-
}
128-
}
129-
}
130-
13197
/**
13298
* Process the function if it is used as a first class callable.
13399
*

0 commit comments

Comments
 (0)