PhpCsFixer\Fixer\PhpTag\NoClosingTagFixer::fix PHP Method

fix() public method

public fix ( SplFileInfo $file, Tokens $tokens )
$file SplFileInfo
$tokens PhpCsFixer\Tokenizer\Tokens
    public function fix(\SplFileInfo $file, Tokens $tokens)
    {
        if (!$tokens->isMonolithicPhp()) {
            return;
        }
        $closeTags = $tokens->findGivenKind(T_CLOSE_TAG);
        if (empty($closeTags)) {
            return;
        }
        list($index, $token) = each($closeTags);
        $tokens->removeLeadingWhitespace($index);
        $token->clear();
        $prevIndex = $tokens->getPrevNonWhitespace($index);
        $prevToken = $tokens[$prevIndex];
        if (!$prevToken->equalsAny(array(';', '}'))) {
            $tokens->insertAt($prevIndex + 1, new Token(';'));
        }
    }