Skip to content

Commit bc445b0

Browse files
committed
Implement small simplifications in the code logic
1 parent fc2c05c commit bc445b0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Diff for: WordPress/AbstractFunctionParameterSniff.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ public function process_matched_token( $stackPtr, $group_name, $matched_content
8888
* @return bool
8989
*/
9090
public function is_targetted_token( $stackPtr ) {
91-
$is_target_token = parent::is_targetted_token( $stackPtr );
92-
93-
if ( ! $is_target_token ) {
91+
if ( ! parent::is_targetted_token( $stackPtr ) ) {
9492
return false;
9593
}
9694

@@ -100,8 +98,9 @@ public function is_targetted_token( $stackPtr ) {
10098
$next = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
10199

102100
// Function import.
103-
if ( ( \T_STRING === $this->tokens[ $prev ]['code'] && 'function' === $this->tokens[ $prev ]['content'] )
104-
&& ( \T_AS === $this->tokens[ $next ]['code'] || \T_SEMICOLON === $this->tokens[ $next ]['code'] )
101+
if ( \T_STRING === $this->tokens[ $prev ]['code']
102+
&& 'function' === $this->tokens[ $prev ]['content']
103+
&& in_array( $this->tokens[ $next ]['code'], array( \T_AS, \T_SEMICOLON ), true )
105104
) {
106105
return false;
107106
}

0 commit comments

Comments
 (0)