diff --git a/packages/Config/RectorConfig.php b/packages/Config/RectorConfig.php index b7849c5b7c3..65f42e2f136 100644 --- a/packages/Config/RectorConfig.php +++ b/packages/Config/RectorConfig.php @@ -60,6 +60,12 @@ public function parallel(int $seconds = 120, int $maxNumberOfProcess = 16, int $ $parameters->set(Option::PARALLEL_JOB_SIZE, $jobSize); } + public function noDiffs(): void + { + $parameters = $this->parameters(); + $parameters->set(Option::NO_DIFFS, true); + } + /** * @param array $criteria */ diff --git a/src/Configuration/ConfigurationFactory.php b/src/Configuration/ConfigurationFactory.php index fc8197feca6..901af26f04b 100644 --- a/src/Configuration/ConfigurationFactory.php +++ b/src/Configuration/ConfigurationFactory.php @@ -40,7 +40,7 @@ public function createFromInput(InputInterface $input): Configuration $outputFormat = (string) $input->getOption(Option::OUTPUT_FORMAT); $showProgressBar = $this->shouldShowProgressBar($input, $outputFormat); - $showDiffs = ! (bool) $input->getOption(Option::NO_DIFFS); + $showDiffs = $this->shouldShowDiffs($input); $paths = $this->resolvePaths($input); @@ -82,6 +82,17 @@ private function shouldShowProgressBar(InputInterface $input, string $outputForm return $outputFormat === ConsoleOutputFormatter::NAME; } + private function shouldShowDiffs(InputInterface $input): bool + { + $noDiffs = (bool) $input->getOption(Option::NO_DIFFS); + if ($noDiffs) { + return false; + } + + // fallback to parameter + return ! $this->parameterProvider->provideBoolParameter(Option::NO_DIFFS); + } + /** * @param string[] $commandLinePaths * @return string[]