From 7cd1d70dcfbfb57a41f6043b15761b4050365c7b Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Tue, 18 Feb 2020 13:23:06 +0100 Subject: [PATCH] StubValidator - set analysed files to correctly analysed stubbed traits --- src/PhpDoc/StubValidator.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PhpDoc/StubValidator.php b/src/PhpDoc/StubValidator.php index 87d29e4e57..d67592c451 100644 --- a/src/PhpDoc/StubValidator.php +++ b/src/PhpDoc/StubValidator.php @@ -3,6 +3,7 @@ namespace PHPStan\PhpDoc; use PHPStan\Analyser\FileAnalyser; +use PHPStan\Analyser\NodeScopeResolver; use PHPStan\Broker\Broker; use PHPStan\DependencyInjection\Container; use PHPStan\DependencyInjection\DerivativeContainerFactory; @@ -79,6 +80,10 @@ public function validate(): array /** @var FileAnalyser $fileAnalyser */ $fileAnalyser = $container->getByType(FileAnalyser::class); + /** @var NodeScopeResolver $nodeScopeResolver */ + $nodeScopeResolver = $container->getByType(NodeScopeResolver::class); + $nodeScopeResolver->setAnalysedFiles($this->stubFiles); + $errors = []; foreach ($this->stubFiles as $stubFile) { $tmpErrors = $fileAnalyser->analyseFile(