registerContext() public method

public registerContext ( ParserContext $context )
$context GrumPHP\Parser\Php\Context\ParserContext
Esempio n. 1
0
 /**
  * @param array         $parserOptions
  * @param ParserContext $context
  *
  * @return NodeTraverser
  * @throws \GrumPHP\Exception\RuntimeException
  */
 public function createForTaskContext(array $parserOptions, ParserContext $context)
 {
     $this->configurator->registerOptions($parserOptions);
     $this->configurator->registerContext($context);
     $traverser = new NodeTraverser();
     $this->configurator->configure($traverser);
     return $traverser;
 }
Esempio n. 2
0
 function it_can_create_a_task_and_context_specific_traverser(TraverserConfigurator $configurator, ParserContext $context)
 {
     $taskOptions = ['visitors' => []];
     $configurator->registerOptions($taskOptions)->shouldBeCalled();
     $configurator->registerContext($context)->shouldBeCalled();
     $configurator->configure(Argument::type(NodeTraverser::class))->shouldBeCalled();
     $this->createForTaskContext($taskOptions, $context)->shouldBeAnInstanceOf(NodeTraverser::class);
 }