protected function checkFileInternal(CheckContext $checkContext, Config $config)
{
$file = $checkContext->getFile();
$tokens = $checkContext->getTokenList();
$endToken = $tokens->end()->current();
if (count($file) > 0) {
if ($config->get('endwith') && !$endToken->isType(T_CLOSE_TAG)) {
$this->addViolation($file, $endToken->getLine(), 0, 'Files must end with a closing tag.');
} elseif (!$config->get('endwith') && $endToken->isType(T_CLOSE_TAG)) {
$this->addViolation($file, $endToken->getLine(), 0, 'Files must not end with a closing tag.');
}
}
}