| @@ 101-109 (lines=9) @@ | ||
| 98 | if ($tokens[$stackPtr]['code'] === T_WHILE) { |
|
| 99 | // This could be from a DO WHILE, which doesn't have an opening brace. |
|
| 100 | $lastContent = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true); |
|
| 101 | if ($tokens[$lastContent]['code'] === T_CLOSE_CURLY_BRACKET) { |
|
| 102 | $brace = $tokens[$lastContent]; |
|
| 103 | if (isset($brace['scope_condition']) === true) { |
|
| 104 | $condition = $tokens[$brace['scope_condition']]; |
|
| 105 | if ($condition['code'] === T_DO) { |
|
| 106 | return; |
|
| 107 | } |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||
| 111 | // In Javascript DO WHILE loops without curly braces are legal. This |
|
| 112 | // is only valid if a single statement is present between the DO and |
|
| @@ 170-179 (lines=10) @@ | ||
| 167 | $i = ($stackPtr - 1); |
|
| 168 | $foundLines = 0; |
|
| 169 | while ($currentLine !== $prevLine && $currentLine > 1 && $i > 0) { |
|
| 170 | if (isset($tokens[$i]['scope_condition']) === true) { |
|
| 171 | $scopeCondition = $tokens[$i]['scope_condition']; |
|
| 172 | if ($tokens[$scopeCondition]['code'] === T_FUNCTION) { |
|
| 173 | // Found a previous function. |
|
| 174 | return; |
|
| 175 | } |
|
| 176 | } else if ($tokens[$i]['code'] === T_FUNCTION) { |
|
| 177 | // Found another interface function. |
|
| 178 | return; |
|
| 179 | } |
|
| 180 | ||
| 181 | $currentLine = $tokens[$i]['line']; |
|
| 182 | if ($currentLine === $prevLine) { |
|