Exemplo n.º 1
0
 private function fixSpaceAroundToken(Tokens $tokens)
 {
     $controlTokens = $this->getControlTokens();
     for ($index = $tokens->count() - 1; 0 <= $index; --$index) {
         $token = $tokens[$index];
         if ($token->isGivenKind($controlTokens) || $token->isGivenKind(T_USE)) {
             $tokens->ensureWhitespaceAtIndex($index + 1, 0, ' ');
             $prevToken = $tokens[$index - 1];
             if (!$prevToken->isWhitespace() && !$prevToken->isComment() && !$prevToken->isGivenKind(T_OPEN_TAG)) {
                 $tokens->ensureWhitespaceAtIndex($index - 1, 1, ' ');
             }
         }
     }
 }