protected function checkFileInternal(CheckContext $checkContext, Config $config)
{
$file = $checkContext->getFile();
$tokens = $checkContext->getTokenList();
$this->setPattern($config->get('pattern', $this->pattern));
try {
do {
// Jump us to the next token we want to check.
$tokens->seekToType(T_VARIABLE);
$token = $tokens->current();
if (in_array($token->getContent(), $this->ignoredVariables)) {
continue;
}
if (!preg_match($this->pattern, $token->getContent())) {
$this->addViolation($file, $token->getLine(), $token->getColumn(), sprintf('Variable `%s` should follow the `%s` pattern', $token->getContent(), addslashes($this->pattern)), Violation::SEVERITY_ERROR);
}
} while ($tokens->valid());
} catch (\HippoPHP\Tokenizer\Exception\OutOfBoundsException $e) {
// Ignore the exception, we're at the end of the file.
}
}