From c617786daa59992432c2fc0a7ffbe6da242ec5be Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 28 Aug 2026 10:35:52 +0200 Subject: [PATCH 1/2] [ChangesReporting] Deprecate github and gitlab output formats Rector is a refactoring tool, not a static analysis tool. The github and gitlab code-quality output formats fit static analysers, not Rector, so deprecate both. They will be removed in the next minor version. A deprecation warning is printed to STDERR (via error style), so the machine-readable output on STDOUT stays clean. Claude-Session: https://claude.ai/code/session_01Ajwt4SBryQ2b5hvv2SMAds --- src/ChangesReporting/Output/GitHubOutputFormatter.php | 2 ++ src/ChangesReporting/Output/GitlabOutputFormatter.php | 3 +++ src/Console/Command/ProcessCommand.php | 10 ++++++++++ 3 files changed, 15 insertions(+) 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); From 851166c3a75026aebe7a9ff49164f0888b9dd492 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 28 Aug 2026 10:43:14 +0200 Subject: [PATCH 2/2] Ignore deprecation errors in GitHubOutputFormatterTest The test intentionally exercises the now-deprecated formatter until removal. Claude-Session: https://claude.ai/code/session_01Ajwt4SBryQ2b5hvv2SMAds --- phpstan.neon | 9 +++++++++ 1 file changed, 9 insertions(+) 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