Skip to content

Commit

Permalink
Fix break/continue variable argument bug with closing tag after break…
Browse files Browse the repository at this point in the history
…/continue.
  • Loading branch information
jrfnl committed Jun 10, 2017
1 parent c2bbf8e commit f27ff80
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
}

$tokens = $phpcsFile->getTokens();
$nextSemicolonToken = $phpcsFile->findNext(T_SEMICOLON, ($stackPtr), null, false);
$nextSemicolonToken = $phpcsFile->findNext(array(T_SEMICOLON, T_CLOSE_TAG), ($stackPtr), null, false);
$errorType = '';
for ($curToken = $stackPtr + 1; $curToken < $nextSemicolonToken; $curToken++) {
if ($tokens[$curToken]['type'] === 'T_STRING') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public function dataNoFalsePositives()
array(39),
array(44),
array(48),
array(117),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,7 @@
}
}
}

for ($x=0;$x<5;$x++):
if ($x) continue ?> <?php
endfor;

0 comments on commit f27ff80

Please sign in to comment.