Psecio\Parse\Scanner::__construct PHP Method

__construct() public method

Optionally inject parser
public __construct ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher, Psecio\Parse\CallbackVisitor $visitor, PhpParser\Parser $parser = null, NodeTraverser $traverser = null )
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$visitor Psecio\Parse\CallbackVisitor
$parser PhpParser\Parser
$traverser PhpParser\NodeTraverser
    public function __construct(EventDispatcherInterface $dispatcher, CallbackVisitor $visitor, Parser $parser = null, NodeTraverser $traverser = null)
    {
        $this->dispatcher = $dispatcher;
        $this->visitor = $visitor;
        $this->parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
        $this->traverser = $traverser ?: new NodeTraverser();
        $this->visitor->onNodeFailure([$this, 'onNodeFailure']);
        $this->traverser->addVisitor($this->visitor);
    }