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
9 changes: 9 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/ChangesReporting/Output/GitHubOutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 3 additions & 0 deletions src/ChangesReporting/Output/GitlabOutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
10 changes: 10 additions & 0 deletions src/Console/Command/ProcessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading