diff --git a/phpstan.neon b/phpstan.neon index d479d17988d..ea6830a4c95 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -72,6 +72,15 @@ parameters: message: '#deprecated (class|interface) Rector\\(Set|Bridge)\\#' path: src/Configuration/RectorConfigBuilder.php + # the deprecated github/gitlab output formatters are still tested until removed in next minor version + - + identifier: new.deprecatedClass + path: tests/ChangesReporting/Output/GitHubOutputFormatterTest.php + + - + identifier: method.deprecatedClass + path: tests/ChangesReporting/Output/GitHubOutputFormatterTest.php + - identifier: argument.templateType path: rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayReduceRector.php diff --git a/src/ChangesReporting/Output/GitHubOutputFormatter.php b/src/ChangesReporting/Output/GitHubOutputFormatter.php index f0d3bb8359a..96a643f118e 100644 --- a/src/ChangesReporting/Output/GitHubOutputFormatter.php +++ b/src/ChangesReporting/Output/GitHubOutputFormatter.php @@ -18,6 +18,8 @@ use Rector\ValueObject\ProcessResult; /** + * @deprecated Will be removed in next minor version, as Rector is not a static analysis tool. + * * @phpstan-type AnnotationProperties array{title?: string|null, file?: string|null, col?: int|null, endColumn?: int|null, line?: int|null, endLine?: int|null} * @see \Rector\Tests\ChangesReporting\Output\GitHubOutputFormatterTest */ diff --git a/src/ChangesReporting/Output/GitlabOutputFormatter.php b/src/ChangesReporting/Output/GitlabOutputFormatter.php index d43ac4ba2a2..970113e1066 100644 --- a/src/ChangesReporting/Output/GitlabOutputFormatter.php +++ b/src/ChangesReporting/Output/GitlabOutputFormatter.php @@ -15,6 +15,9 @@ use Rector\ValueObject\Configuration; use Rector\ValueObject\ProcessResult; +/** + * @deprecated Will be removed in next minor version, as Rector is not a static analysis tool. + */ final readonly class GitlabOutputFormatter implements OutputFormatterInterface { private const string NAME = 'gitlab'; diff --git a/src/Console/Command/ProcessCommand.php b/src/Console/Command/ProcessCommand.php index 3584f357ba8..0a210a2b908 100644 --- a/src/Console/Command/ProcessCommand.php +++ b/src/Console/Command/ProcessCommand.php @@ -176,6 +176,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int // 3. reporting phaseRunning 2nd time with collectors data // report diffs and errors $outputFormat = $configuration->getOutputFormat(); + + // warn about deprecated static-analysis-oriented output formats, to be removed in next minor version + if (in_array($outputFormat, ['github', 'gitlab'], true)) { + $this->symfonyStyle->getErrorStyle() + ->warning(sprintf( + 'The "%s" output format is deprecated and will be removed in the next minor version, as Rector is not a static analysis tool.', + $outputFormat + )); + } + $outputFormatter = $this->outputFormatterCollector->getByName($outputFormat); $outputFormatter->report($processResult, $configuration);