/**
* @param ContextInterface $context
*
* @return FileContext
*/
public function checkContext(ContextInterface $context)
{
try {
$parsedStatements = $this->parser->parse($context->getCheckedCode());
$this->traverser->traverse($parsedStatements, $context, $this->lexer->getTokens());
} catch (\Exception $e) {
$context->addError(new CheckError($e->getMessage()));
} catch (\ParseException $e) {
$context->addError(new CheckError($e->getMessage(), $e->getLine()));
}
}