Skip to content
Merged
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
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ parameters:
- src/StaticTypeMapper/Naming/NameScopeFactory.php
- utils/phpstan/src/Rule/NoResolveClassReflectionInForeachRule.php

# services are instantiated by the container via reflection, which shipmonk cannot see
-
identifier: shipmonk.deadMethod
message: '#::__construct$#'

# called magically by parent
-
message: '#^Unused Rector\\PhpParser\\Printer\\BetterStandardPrinter\:\:(pInterpolatedStringPart|pStmt_FileNode)$#'
Expand Down
9 changes: 4 additions & 5 deletions src/Application/ApplicationFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use Rector\ValueObject\FileProcessResult;
use Rector\ValueObject\ProcessResult;
use Rector\ValueObject\Reporting\FileDiff;
use Symfony\Component\Console\Input\InputInterface;
use Throwable;

final class ApplicationFileProcessor
Expand All @@ -54,7 +53,7 @@ public function __construct(
) {
}

public function run(Configuration $configuration, InputInterface $input): ProcessResult
public function run(Configuration $configuration): ProcessResult
{
// scope the cache to this run's --only / --only-suffix selection before any cache read/write
$this->changedFilesDetector->setActiveScope($configuration->getOnlyRules(), $configuration->getOnlySuffix(), $configuration->getFilters());
Expand Down Expand Up @@ -97,7 +96,7 @@ public function run(Configuration $configuration, InputInterface $input): Proces
}

if ($configuration->isParallel()) {
$processResult = $this->runParallel($filePaths, $input, $postFileCallback);
$processResult = $this->runParallel($filePaths, $configuration, $postFileCallback);
} else {
$processResult = $this->processFiles($filePaths, $configuration, $preFileCallback, $postFileCallback);
}
Expand Down Expand Up @@ -260,7 +259,7 @@ private function restoreErrorHandler(): void
*/
private function runParallel(
array $filePaths,
InputInterface $input,
Configuration $configuration,
callable $postFileCallback,
): ProcessResult {
$mainScript = $this->resolveCalledRectorBinary();
Expand All @@ -277,7 +276,7 @@ private function runParallel(
$schedule = $this->scheduleFactory->create($cpuCores, $jobSize, $maxNumberOfProcesses, $filePaths);

// mimics see https://github.com/phpstan/phpstan-src/commit/9124c66dcc55a222e21b1717ba5f60771f7dda92#diff-387b8f04e0db7a06678eb52ce0c0d0aff73e0d7d8fc5df834d0a5fbec198e5daR139
return $this->parallelFileProcessor->process($schedule, $mainScript, $postFileCallback, $input);
return $this->parallelFileProcessor->process($schedule, $mainScript, $postFileCallback, $configuration);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/ProcessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

// MAIN PHASE
// 2. run Rector
$processResult = $this->applicationFileProcessor->run($configuration, $input);
$processResult = $this->applicationFileProcessor->run($configuration);

// REPORTING PHASE
// 3. reporting phaseRunning 2nd time with collectors data
Expand Down
10 changes: 4 additions & 6 deletions src/Parallel/Application/ParallelFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use React\Socket\TcpServer;
use Rector\Configuration\Option;
use Rector\Configuration\Parameter\SimpleParameterProvider;
use Rector\Console\Command\ProcessCommand;
use Rector\Console\ExitCode;
use Rector\Parallel\Command\WorkerCommandLineFactory;
use Rector\Parallel\Enum\Action;
Expand All @@ -24,9 +23,9 @@
use Rector\Parallel\ValueObject\ParallelProcess;
use Rector\Parallel\ValueObject\ProcessPool;
use Rector\Parallel\ValueObject\Schedule;
use Rector\ValueObject\Configuration;
use Rector\ValueObject\Error\SystemError;
use Rector\ValueObject\ProcessResult;
use Symfony\Component\Console\Input\InputInterface;
use Throwable;

/**
Expand Down Expand Up @@ -58,7 +57,7 @@ public function process(
Schedule $schedule,
string $mainScript,
callable $postFileCallback,
InputInterface $input
Configuration $configuration
): ProcessResult {
// reversed, so that array_pop() hands out the jobs in bucket order
$jobsPerWorker = array_map(
Expand Down Expand Up @@ -157,7 +156,7 @@ public function process(
&$systemErrorsCount,
&$reachedSystemErrorsCountLimit,
$mainScript,
$input,
$configuration,
$serverPort,
$streamSelectLoop,
$timeoutInSeconds,
Expand All @@ -172,9 +171,8 @@ public function process(

$workerCommandLine = $this->workerCommandLineFactory->create(
$mainScript,
ProcessCommand::class,
'worker',
$input,
$configuration,
$processIdentifier,
$serverPort,
);
Expand Down
Loading
Loading