Skip to content

Commit 9fdbd6e

Browse files
authored
Merge pull request #1387 from rodrigoprimo/findnext-return-value
Generic/InlineControlStructure: fix unchecked findNext() return value
2 parents 960d09c + 6be4ea7 commit 9fdbd6e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function process(File $phpcsFile, int $stackPtr)
6565
// Ignore the ELSE in ELSE IF. We'll process the IF part later.
6666
if ($tokens[$stackPtr]['code'] === T_ELSE) {
6767
$next = $phpcsFile->findNext(Tokens::EMPTY_TOKENS, ($stackPtr + 1), null, true);
68-
if ($tokens[$next]['code'] === T_IF) {
68+
if ($next === false || $tokens[$next]['code'] === T_IF) {
6969
return;
7070
}
7171
}

0 commit comments

Comments
 (0)