traverse() public method

public traverse ( array $nodes, Sstalle\php7cc\CompatibilityViolation\ContextInterface $context = null, array $tokens = [] )
$nodes array
$context Sstalle\php7cc\CompatibilityViolation\ContextInterface
$tokens array
示例#1
0
 /**
  * @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()));
     }
 }
示例#2
0
 /**
  * @param ContextInterface $context
  * @return FileContext
  */
 public function checkContext(ContextInterface $context)
 {
     $parsedStatements = $this->parser->parse($context->getCheckedCode());
     $this->traverser->traverse($parsedStatements, $context, $this->lexer->getTokens());
 }