PhpCsFixer\Fixer\Basic\BracesFixer::fixDoWhile PHP Method

fixDoWhile() private method

private fixDoWhile ( Tokens $tokens )
$tokens PhpCsFixer\Tokenizer\Tokens
    private function fixDoWhile(Tokens $tokens)
    {
        for ($index = count($tokens) - 1; 0 <= $index; --$index) {
            $token = $tokens[$index];
            if (!$token->isGivenKind(T_DO)) {
                continue;
            }
            $parenthesisEndIndex = $this->findParenthesisEnd($tokens, $index);
            $startBraceIndex = $tokens->getNextNonWhitespace($parenthesisEndIndex);
            $endBraceIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $startBraceIndex);
            $nextNonWhitespaceIndex = $tokens->getNextNonWhitespace($endBraceIndex);
            $nextNonWhitespaceToken = $tokens[$nextNonWhitespaceIndex];
            if (!$nextNonWhitespaceToken->isGivenKind(T_WHILE)) {
                continue;
            }
            $tokens->ensureWhitespaceAtIndex($nextNonWhitespaceIndex - 1, 1, ' ');
        }
    }