Skip to content

Commit 30f78b5

Browse files
committed
Generic/DisallowYodaConditions: remove redundant condition
The condition in the `if` already takes everything that's not an array, so if we reach the `elseif` we can be sure it's a `T_ARRAY` token.
1 parent 054f23b commit 30f78b5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Standards/Generic/Sniffs/ControlStructures/DisallowYodaConditionsSniff.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ public function process(File $phpcsFile, $stackPtr)
110110
if ($prev === false) {
111111
return;
112112
}
113-
} else if ($tokens[$beforeOpeningParenthesisIndex]['code'] === T_ARRAY
114-
&& $this->isArrayStatic($phpcsFile, $beforeOpeningParenthesisIndex) === false
115-
) {
113+
} else if ($this->isArrayStatic($phpcsFile, $beforeOpeningParenthesisIndex) === false) {
116114
return;
117115
}//end if
118116
}//end if

0 commit comments

Comments
 (0)