Skip to content

Commit

Permalink
Merge branch 'master' into phpcs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Feb 14, 2014
2 parents 10ed1c3 + 2679192 commit cb390f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,8 @@ if ($foo):
elseif ($baz):
$foo = 2;
endif;
endif;

if ($foo):
else if ($baz): $foo = 2;
endif;
7 changes: 7 additions & 0 deletions CodeSniffer/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,13 @@ public function processAdditional(&$tokens, $eolChar)

$numTokens = count($tokens);
for ($i = ($numTokens - 1); $i >= 0; $i--) {
// Check for any unset scope conditions due to alternate IF/ENDIF syntax.
if (isset($tokens[$i]['scope_opener']) === true
&& isset($tokens[$i]['scope_condition']) === false
) {
$tokens[$i]['scope_condition'] = $tokens[$tokens[$i]['scope_opener']]['scope_condition'];
}

// Looking for functions that are actually closures.
if ($tokens[$i]['code'] === T_FUNCTION && isset($tokens[$i]['scope_opener']) === true) {
for ($x = ($i + 1); $x < $numTokens; $x++) {
Expand Down

0 comments on commit cb390f4

Please sign in to comment.