Skip to content

Commit a93ac84

Browse files
committed
Fix notice
1 parent 647fe0a commit a93ac84

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

PSR2R/Sniffs/ControlStructures/UnneededElseSniff.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ public function process(File $phpcsFile, $stackPtr) {
7171
return;
7272
}
7373

74+
if (empty($tokens[$stackPtr]['scope_opener']) || empty($tokens[$stackPtr]['scope_closer'])) {
75+
return;
76+
}
77+
7478
$phpcsFile->fixer->beginChangeset();
7579

7680
$prevIndex = $phpcsFile->findPrevious(T_WHITESPACE, $stackPtr - 1, null, true);
77-
//$indentationLevel = $tokens[$prevIndex]['column'] - 1;
7881
$line = $tokens[$prevIndex]['line'];
7982

8083
for ($i = $prevIndex + 1; $i < $stackPtr; $i++) {
@@ -102,12 +105,10 @@ public function process(File $phpcsFile, $stackPtr) {
102105
}
103106

104107
// Fix indentation
105-
//$currentLine = $line;
106108
for ($i = $nextScopeStartIndex + 1; $i < $prevEndIndex; $i++) {
107109
if ($tokens[$i]['line'] === $line || $tokens[$i]['type'] !== 'T_WHITESPACE') {
108110
continue;
109111
}
110-
//$currentLine = $tokens[$i]['line'];
111112
$this->outdent($phpcsFile, $i);
112113
}
113114

0 commit comments

Comments
 (0)