Skip to content

Commit fe2eaf3

Browse files
authored
Merge pull request #840 from Automattic/feature/fix-problematic-token-comparisons
2 parents af10c81 + be6a932 commit fe2eaf3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

WordPressVIPMinimum/Sniffs/Hooks/AlwaysReturnInFilterSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function process_token( $stackPtr ) {
7676
return;
7777
}
7878

79-
if ( $this->tokens[ $callbackPtr ]['code'] === 'PHPCS_T_CLOSURE' ) {
79+
if ( $this->tokens[ $callbackPtr ]['code'] === T_CLOSURE ) {
8080
$this->processFunctionBody( $callbackPtr );
8181
} elseif ( $this->tokens[ $callbackPtr ]['code'] === T_ARRAY
8282
|| $this->tokens[ $callbackPtr ]['code'] === T_OPEN_SHORT_ARRAY
@@ -262,7 +262,7 @@ private function isInsideIfConditonal( $stackPtr ) {
262262
}
263263

264264
// Similar case may be a conditional closure.
265-
if ( end( $this->tokens[ $stackPtr ]['conditions'] ) === 'PHPCS_T_CLOSURE' ) {
265+
if ( end( $this->tokens[ $stackPtr ]['conditions'] ) === T_CLOSURE ) {
266266
return false;
267267
}
268268

WordPressVIPMinimum/Sniffs/Hooks/PreGetPostsSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function process_token( $stackPtr ) {
7676
return;
7777
}
7878

79-
if ( $this->tokens[ $callbackPtr ]['code'] === 'PHPCS_T_CLOSURE' ) {
79+
if ( $this->tokens[ $callbackPtr ]['code'] === T_CLOSURE ) {
8080
$this->processClosure( $callbackPtr );
8181
} elseif ( $this->tokens[ $callbackPtr ]['code'] === T_ARRAY
8282
|| $this->tokens[ $callbackPtr ]['code'] === T_OPEN_SHORT_ARRAY
@@ -388,7 +388,7 @@ private function isWPQueryMethodCall( $stackPtr, $method = null ) {
388388
true
389389
);
390390

391-
if ( ! $next || $this->tokens[ $next ]['type'] !== 'T_OBJECT_OPERATOR' ) {
391+
if ( ! $next || $this->tokens[ $next ]['code'] !== T_OBJECT_OPERATOR ) {
392392
return false;
393393
}
394394

0 commit comments

Comments
 (0)