/** * Initialize bindings after the application is initialized and config is loaded * * @param array $configuration */ public function postBind(array $configuration) { $this->container->instance('config', $configuration); // Setup AnalysisException ComplexityComputing AnalysisException::setComplexityComputer($this->container['complexity-computer']); $this->container->bind('message-provider', function ($container) { return new MessageProvider($container['config']); }); $this->container->bind('flaw-detector', function ($container) { return new FlawDetector($container['bootstrapper'], $container['config']); }); $this->container->bind('analyzer', function ($container) { return $this->bootstrap(new Analyzer($container['parser'], $container['flaw-detector'])); }); $this->container->bind(FeedbackInterface::class, function ($container) { return new ConsolePlainFeedback($container['config'], $container['output']); }); $this->container->bind('report-generator', function ($container) { return new ReportGenerator($container['filesystem']); }); $this->container->bind('report-service', function ($container) { return new ReportService($container['report-generator']); }); $this->container->bind('analyzer-service', function ($container) { return new AnalyzerService($container['analyzer'], $container['code-scanner'], $container[FeedbackInterface::class], $container['report-service']); }); $this->container->bind(InspectCommand::class, function ($container) { return new InspectCommand($container['analyzer-service']); }); }
public function testWalkerCapturesAllAnalysisExceptionsAndReturnsThem() { $ast = $this->parseSource(file_get_contents(STUBPATH . '/walk/class_2.php')); $walker = new NodeWalker(); $errors = $walker->walk($ast, function (Node $node) { throw AnalysisException::withNode($node); }); $this->assertCount(9, $errors); $this->assertArrayOf(AnalysisException::class, $errors); }
public function getNode() { return $this->exception->getNode(); }