protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        if (\count($tokens) < 2 || !$tokens->isMonolithicPhp()) {
            return;
        }

        if (!$tokens->isTokenKindFound(T_CLOSE_TAG)) {
            return;
        }

        $closeTags = $tokens->findGivenKind(T_CLOSE_TAG);
        $index = key($closeTags);

        if (isset($tokens[$index - 1]) && $tokens[$index - 1]->isWhitespace()) {
            $tokens->clearAt($index - 1);
        }
        $tokens->clearAt($index);

        $prevIndex = $tokens->getPrevMeaningfulToken($index);
        if (!$tokens[$prevIndex]->equalsAny([';', '}', [T_OPEN_TAG]])) {
            $tokens->insertAt($prevIndex + 1, new Token(';'));
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        if (\count($tokens) < 2 || !$tokens->isMonolithicPhp()) {
            return;
        }

        if (!$tokens->isTokenKindFound(T_CLOSE_TAG)) {
            return;
        }

        $closeTags = $tokens->findGivenKind(T_CLOSE_TAG);
        $index = key($closeTags);

        if (isset($tokens[$index - 1]) && $tokens[$index - 1]->isWhitespace()) {
            $tokens->clearAt($index - 1);
        }
        $tokens->clearAt($index);

        $prevIndex = $tokens->getPrevMeaningfulToken($index);
        if (!$tokens[$prevIndex]->equalsAny([';', '}', [T_OPEN_TAG]])) {
            $tokens->insertAt($prevIndex + 1, new Token(';'));
        }
    }
{@inheritdoc}