CommandDefaultNameAndDescriptionToAsCommandAttributeRector

Replace getDefaultName() and getDefaultDescription() by #[AsCommand] attribute

+use Symfony\Component\Console\Attribute\AsCommand;
 use Symfony\Component\Console\Command\Command;

+#[AsCommand(
+    name: 'app:some-command',
+    description: 'This is some command description'
+)]
 final class SomeCommand extends Command
 {
-    public static function getDefaultName(): string
-    {
-        return 'app:some-command';
-    }
-
-    public static function getDefaultDescription(): string
-    {
-        return 'This is some command description';
-    }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony73\Rector\Class_\CommandDefaultNameAndDescriptionToAsCommandAttributeRector;

return RectorConfig::configure()
    ->withRules([
        CommandDefaultNameAndDescriptionToAsCommandAttributeRector::class,
    ]);