Skip to content

Commit 96db028

Browse files
committed
Fix bug in UnneededElse.
1 parent 410f05d commit 96db028

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PSR2R/Sniffs/ControlStructures/UnneededElseSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function isNotLastCondition(File $phpcsFile, int $stackPtr): bool {
145145

146146
$nextScopeEndIndex = $tokens[$stackPtr]['scope_closer'];
147147

148-
$nextConditionStartIndex = $phpcsFile->findNext(T_WHITESPACE, $nextScopeEndIndex - 1, null, true);
148+
$nextConditionStartIndex = $phpcsFile->findNext(T_WHITESPACE, $nextScopeEndIndex + 1, null, true);
149149

150150
if (in_array($tokens[$nextConditionStartIndex]['code'], [T_ELSEIF, T_ELSE], true)) {
151151
return true;

0 commit comments

Comments
 (0)