Skip to content

Commit 2d98ddd

Browse files
committed
Revert "Debugging messages for parallel analysis"
This reverts commit 8c5ee83.
1 parent cec1be7 commit 2d98ddd

File tree

5 files changed

+10
-28
lines changed

5 files changed

+10
-28
lines changed

src/Command/AnalyseApplication.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private function runAnalyser(
186186
$postFileCallback = null;
187187
}
188188

189-
$analyserResult = $this->analyserRunner->runAnalyser($files, $allAnalysedFiles, $preFileCallback, $postFileCallback, $debug, true, $projectConfigFile, null, null, $input, $errorOutput);
189+
$analyserResult = $this->analyserRunner->runAnalyser($files, $allAnalysedFiles, $preFileCallback, $postFileCallback, $debug, true, $projectConfigFile, null, null, $input);
190190

191191
if (isset($progressStarted) && $progressStarted) {
192192
$errorOutput->getStyle()->progressFinish();

src/Command/AnalyserRunner.php

+2-7
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ public function runAnalyser(
5757
?string $projectConfigFile,
5858
?string $tmpFile,
5959
?string $insteadOfFile,
60-
InputInterface $input,
61-
Output $output
60+
InputInterface $input
6261
): AnalyserResult
6362
{
6463
$filesCount = count($files);
@@ -72,17 +71,13 @@ public function runAnalyser(
7271
$mainScript = $_SERVER['argv'][0];
7372
}
7473

75-
if ($output->isDebug()) {
76-
$output->writeLineFormatted(sprintf('Schedule: %d processes, %d jobs', $schedule->getNumberOfProcesses(), count($schedule->getJobs())));
77-
}
78-
7974
if (
8075
!$debug
8176
&& $allowParallel
8277
&& $mainScript !== null
8378
&& $schedule->getNumberOfProcesses() > 1
8479
) {
85-
return $this->parallelAnalyser->analyse($schedule, $mainScript, $postFileCallback, $projectConfigFile, $tmpFile, $insteadOfFile, $input, $output);
80+
return $this->parallelAnalyser->analyse($schedule, $mainScript, $postFileCallback, $projectConfigFile, $tmpFile, $insteadOfFile, $input);
8681
}
8782

8883
return $this->analyser->analyse(

src/Command/FixerWorkerCommand.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
154154
$configuration,
155155
$tmpFile,
156156
$insteadOfFile,
157-
$input,
158-
$inceptionResult->getErrorOutput()
157+
$input
159158
);
160159
$result = $resultCacheManager->process(
161160
$this->switchTmpFileInAnalyserResult($intermediateAnalyserResult, $tmpFile, $insteadOfFile),

src/Parallel/ParallelAnalyser.php

+3-15
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Nette\Utils\Random;
88
use PHPStan\Analyser\AnalyserResult;
99
use PHPStan\Analyser\Error;
10-
use PHPStan\Command\Output;
1110
use PHPStan\Dependency\ExportedNode;
1211
use PHPStan\Process\ProcessHelper;
1312
use React\EventLoop\StreamSelectLoop;
@@ -53,8 +52,7 @@ public function analyse(
5352
?string $projectConfigFile,
5453
?string $tmpFile,
5554
?string $insteadOfFile,
56-
InputInterface $input,
57-
Output $errorOutput
55+
InputInterface $input
5856
): AnalyserResult
5957
{
6058
$jobs = array_reverse($schedule->getJobs());
@@ -133,7 +131,7 @@ public function analyse(
133131
$commandOptions,
134132
$input
135133
), $loop, $this->processTimeout);
136-
$process->start(function (array $json) use ($process, &$internalErrors, &$errors, &$dependencies, &$exportedNodes, &$jobs, $postFileCallback, &$internalErrorsCount, &$reachedInternalErrorsCountLimit, $processIdentifier, $errorOutput): void {
134+
$process->start(function (array $json) use ($process, &$internalErrors, &$errors, &$dependencies, &$exportedNodes, &$jobs, $postFileCallback, &$internalErrorsCount, &$reachedInternalErrorsCountLimit, $processIdentifier): void {
137135
foreach ($json['errors'] as $jsonError) {
138136
if (is_string($jsonError)) {
139137
$internalErrors[] = sprintf('Internal error: %s', $jsonError);
@@ -177,24 +175,14 @@ public function analyse(
177175
}
178176

179177
if (count($jobs) === 0) {
180-
if ($errorOutput->isDebug()) {
181-
$errorOutput->writeLineFormatted(sprintf('Process %s ended successfully - no more jobs remaining.', $processIdentifier));
182-
}
183178
$this->processPool->quitProcess($processIdentifier);
184179
return;
185180
}
186181

187-
if ($errorOutput->isDebug()) {
188-
$errorOutput->writeLineFormatted(sprintf('Process %s analysis successful - queueing a new job.', $processIdentifier));
189-
}
190-
191182
$job = array_pop($jobs);
192183
$process->request(['action' => 'analyse', 'files' => $job]);
193-
}, $handleError, function ($exitCode, $termSignal, string $output) use (&$internalErrors, &$internalErrorsCount, $processIdentifier, $errorOutput): void {
184+
}, $handleError, function ($exitCode, string $output) use (&$internalErrors, &$internalErrorsCount, $processIdentifier): void {
194185
$this->processPool->tryQuitProcess($processIdentifier);
195-
if ($errorOutput->isDebug()) {
196-
$errorOutput->writeLineFormatted(sprintf('Process %s exited - exit code %s, term signal %s, output: %s', $processIdentifier, $exitCode ?? 'null', $termSignal ?? 'null', $output));
197-
}
198186
if ($exitCode === 0) {
199187
return;
200188
}

src/Parallel/Process.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(
4848
/**
4949
* @param callable(mixed[] $json) : void $onData
5050
* @param callable(\Throwable $exception) : void $onError
51-
* @param callable(?int $exitCode, ?int $termSignal, string $output) : void $onExit
51+
* @param callable(?int $exitCode, string $output) : void $onExit
5252
*/
5353
public function start(callable $onData, callable $onError, callable $onExit): void
5454
{
@@ -69,7 +69,7 @@ public function start(callable $onData, callable $onError, callable $onExit): vo
6969
$this->process->start($this->loop);
7070
$this->onData = $onData;
7171
$this->onError = $onError;
72-
$this->process->on('exit', function ($exitCode, $termSignal) use ($onExit): void {
72+
$this->process->on('exit', function ($exitCode) use ($onExit): void {
7373
$this->cancelTimer();
7474

7575
$output = '';
@@ -84,7 +84,7 @@ public function start(callable $onData, callable $onError, callable $onExit): vo
8484
if (is_string($stdErr)) {
8585
$output .= $stdErr;
8686
}
87-
$onExit($exitCode, $termSignal, $output);
87+
$onExit($exitCode, $output);
8888
fclose($this->stdOut);
8989
fclose($this->stdErr);
9090
});

0 commit comments

Comments
 (0)