Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Analyser/Analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public function __construct(
private FileAnalyser $fileAnalyser,
private RuleRegistry $ruleRegistry,
private CollectorRegistry $collectorRegistry,
private NodeScopeResolver $nodeScopeResolver,
private int $internalErrorsCountLimit,
)
{
Expand All @@ -43,7 +42,6 @@ public function analyse(
$allAnalysedFiles = $files;
}

$this->nodeScopeResolver->setAnalysedFiles($allAnalysedFiles);
$allAnalysedFiles = array_fill_keys($allAnalysedFiles, true);

/** @var list<Error> $errors */
Expand Down
1 change: 1 addition & 0 deletions src/Analyser/FileAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public function analyseFile(
$parserNodes,
$scope,
$nodeCallback,
array_keys($analysedFiles),
);
$unmatchedLineIgnores = $linesToIgnore;
foreach ($temporaryFileErrors as $tmpFileError) {
Expand Down
79 changes: 50 additions & 29 deletions src/Analyser/NodeScopeResolver.php

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/Command/WorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Clue\React\NDJson\Decoder;
use Clue\React\NDJson\Encoder;
use PHPStan\Analyser\FileAnalyser;
use PHPStan\Analyser\NodeScopeResolver;
use PHPStan\Collectors\Registry as CollectorRegistry;
use PHPStan\DependencyInjection\Container;
use PHPStan\File\PathNotFoundException;
Expand Down Expand Up @@ -134,10 +133,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}

/** @var NodeScopeResolver $nodeScopeResolver */
$nodeScopeResolver = $container->getByType(NodeScopeResolver::class);
$nodeScopeResolver->setAnalysedFiles($analysedFiles);

$analysedFiles = array_fill_keys($analysedFiles, true);

$tcpConector = new TcpConnector($loop);
Expand Down
5 changes: 0 additions & 5 deletions src/PhpDoc/StubValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use PHPStan\Analyser\Error;
use PHPStan\Analyser\FileAnalyser;
use PHPStan\Analyser\NodeScopeResolver;
use PHPStan\Broker\Broker;
use PHPStan\Collectors\Registry as CollectorRegistry;
use PHPStan\DependencyInjection\Container;
Expand Down Expand Up @@ -94,10 +93,6 @@ public function validate(array $stubFiles, bool $debug): array
/** @var FileAnalyser $fileAnalyser */
$fileAnalyser = $container->getByType(FileAnalyser::class);

/** @var NodeScopeResolver $nodeScopeResolver */
$nodeScopeResolver = $container->getByType(NodeScopeResolver::class);
$nodeScopeResolver->setAnalysedFiles($stubFiles);

$pathRoutingParser = $container->getService('pathRoutingParser');
$pathRoutingParser->setAnalysedFiles($stubFiles);

Expand Down
1 change: 0 additions & 1 deletion src/Testing/RuleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ private function getAnalyser(): Analyser
$fileAnalyser,
$ruleRegistry,
$collectorRegistry,
$nodeScopeResolver,
50,
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Testing/TypeInferenceTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function processFile(
$this->getEarlyTerminatingFunctionCalls(),
true,
);
$resolver->setAnalysedFiles(array_map(static fn (string $file): string => $fileHelper->normalizePath($file), array_merge([$file], $this->getAdditionalAnalysedFiles())));
$analysedFiles = array_map(static fn (string $file): string => $fileHelper->normalizePath($file), array_merge([$file], $this->getAdditionalAnalysedFiles()));

$scopeFactory = $this->createScopeFactory($reflectionProvider, $typeSpecifier, $dynamicConstantNames);
$scope = $scopeFactory->create(ScopeContext::create($file));
Expand All @@ -71,6 +71,7 @@ public function processFile(
$this->getParser()->parseFile($file),
$scope,
$callback,
$analysedFiles,
);
}

Expand Down
1 change: 0 additions & 1 deletion tests/PHPStan/Analyser/AnalyserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@ private function createAnalyser(bool $reportUnmatchedIgnoredErrors): Analyser
$fileAnalyser,
$ruleRegistry,
$collectorRegistry,
$nodeScopeResolver,
50,
);
}
Expand Down