Skip to content

Commit

Permalink
Rename parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 26, 2022
1 parent deda4bd commit 3432a97
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/Analyser/Analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace PHPStan\Analyser;

use Closure;
use PHPStan\Rules\Registry;
use PHPStan\Rules\Registry as RuleRegistry;
use Throwable;
use function array_fill_keys;
use function array_merge;
Expand All @@ -15,7 +15,7 @@ class Analyser

public function __construct(
private FileAnalyser $fileAnalyser,
private Registry $registry,
private RuleRegistry $ruleRegistry,
private NodeScopeResolver $nodeScopeResolver,
private int $internalErrorsCountLimit,
)
Expand Down Expand Up @@ -57,7 +57,7 @@ public function analyse(
$fileAnalyserResult = $this->fileAnalyser->analyseFile(
$file,
$allAnalysedFiles,
$this->registry,
$this->ruleRegistry,
null,
);
$errors = array_merge($errors, $fileAnalyserResult->getErrors());
Expand Down
8 changes: 4 additions & 4 deletions src/Analyser/FileAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use PHPStan\Rules\LineRuleError;
use PHPStan\Rules\MetadataRuleError;
use PHPStan\Rules\NonIgnorableRuleError;
use PHPStan\Rules\Registry;
use PHPStan\Rules\Registry as RuleRegistry;
use PHPStan\Rules\TipRuleError;
use function array_key_exists;
use function array_keys;
Expand Down Expand Up @@ -59,7 +59,7 @@ public function __construct(
public function analyseFile(
string $file,
array $analysedFiles,
Registry $registry,
RuleRegistry $ruleRegistry,
?callable $outerNodeCallback,
): FileAnalyserResult
{
Expand All @@ -72,7 +72,7 @@ public function analyseFile(
$parserNodes = $this->parser->parseFile($file);
$linesToIgnore = $this->getLinesToIgnoreFromTokens($file, $parserNodes);
$temporaryFileErrors = [];
$nodeCallback = function (Node $node, Scope $scope) use (&$fileErrors, &$fileDependencies, &$exportedNodes, $file, $registry, $outerNodeCallback, $analysedFiles, &$linesToIgnore, &$temporaryFileErrors): void {
$nodeCallback = function (Node $node, Scope $scope) use (&$fileErrors, &$fileDependencies, &$exportedNodes, $file, $ruleRegistry, $outerNodeCallback, $analysedFiles, &$linesToIgnore, &$temporaryFileErrors): void {
if ($node instanceof Node\Stmt\Trait_) {
foreach (array_keys($linesToIgnore[$file] ?? []) as $lineToIgnore) {
if ($lineToIgnore < $node->getStartLine() || $lineToIgnore > $node->getEndLine()) {
Expand All @@ -87,7 +87,7 @@ public function analyseFile(
}
$uniquedAnalysedCodeExceptionMessages = [];
$nodeType = get_class($node);
foreach ($registry->getRules($nodeType) as $rule) {
foreach ($ruleRegistry->getRules($nodeType) as $rule) {
try {
$ruleErrors = $rule->processNode($node, $scope);
} catch (AnalysedCodeException $e) {
Expand Down
10 changes: 5 additions & 5 deletions src/Command/WorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPStan\Analyser\NodeScopeResolver;
use PHPStan\DependencyInjection\Container;
use PHPStan\File\PathNotFoundException;
use PHPStan\Rules\Registry;
use PHPStan\Rules\Registry as RuleRegistry;
use PHPStan\ShouldNotHappenException;
use React\EventLoop\StreamSelectLoop;
use React\Socket\ConnectionInterface;
Expand Down Expand Up @@ -189,9 +189,9 @@ private function runWorker(
$out->on('error', $handleError);
/** @var FileAnalyser $fileAnalyser */
$fileAnalyser = $container->getByType(FileAnalyser::class);
/** @var Registry $registry */
$registry = $container->getByType(Registry::class);
$in->on('data', function (array $json) use ($fileAnalyser, $registry, $out, $analysedFiles, $tmpFile, $insteadOfFile, $output): void {
/** @var RuleRegistry $ruleRegistry */
$ruleRegistry = $container->getByType(RuleRegistry::class);
$in->on('data', function (array $json) use ($fileAnalyser, $ruleRegistry, $out, $analysedFiles, $tmpFile, $insteadOfFile, $output): void {
$action = $json['action'];
if ($action !== 'analyse') {
return;
Expand All @@ -207,7 +207,7 @@ private function runWorker(
if ($file === $insteadOfFile) {
$file = $tmpFile;
}
$fileAnalyserResult = $fileAnalyser->analyseFile($file, $analysedFiles, $registry, null);
$fileAnalyserResult = $fileAnalyser->analyseFile($file, $analysedFiles, $ruleRegistry, null);
$fileErrors = $fileAnalyserResult->getErrors();
$dependencies[$file] = $fileAnalyserResult->getDependencies();
$exportedNodes[$file] = $fileAnalyserResult->getExportedNodes();
Expand Down

0 comments on commit 3432a97

Please sign in to comment.