Skip to content

Commit 6a75209

Browse files
rodrigoprimojrfnl
authored andcommitted
Generic/DisallowYodaConditions: various minor cleanup
* Remove unused variable. * Fix typo in code comment. * Remove incorrect code comment.
1 parent aeb6e5d commit 6a75209

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
@@ -85,7 +85,6 @@ public function process(File $phpcsFile, $stackPtr)
8585

8686
// Is it a parenthesis.
8787
if ($tokens[$previousIndex]['code'] === T_CLOSE_PARENTHESIS) {
88-
// Check what exists inside the parenthesis.
8988
$closeParenthesisIndex = $phpcsFile->findPrevious(
9089
Tokens::$emptyTokens,
9190
($tokens[$previousIndex]['parenthesis_opener'] - 1),
@@ -110,7 +109,7 @@ public function process(File $phpcsFile, $stackPtr)
110109
return;
111110
}
112111

113-
// If there is nothing inside the parenthesis, it it not a Yoda.
112+
// If there is nothing inside the parenthesis, it is not a Yoda condition.
114113
$opener = $tokens[$previousIndex]['parenthesis_opener'];
115114
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($previousIndex - 1), ($opener + 1), true);
116115
if ($prev === false) {
@@ -144,7 +143,6 @@ public function isArrayStatic(File $phpcsFile, $arrayToken)
144143
{
145144
$tokens = $phpcsFile->getTokens();
146145

147-
$arrayEnd = null;
148146
if ($tokens[$arrayToken]['code'] === T_OPEN_SHORT_ARRAY) {
149147
$start = $arrayToken;
150148
$end = $tokens[$arrayToken]['bracket_closer'];

0 commit comments

Comments
 (0)