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(';'));
}
}