Find the best Rector rule to solve your problem. Searching through 676 rules.

Found 2 rules:

CommandHelpToAttributeRector

Moves $this->setHelp() to the "help" named argument of #[AsCommand]

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

-#[AsCommand(name: 'app:some')]
+#[AsCommand(name: 'app:some', help: <<<'TXT'
+Some help text
+TXT)]
 final class SomeCommand extends Command
 {
-    protected function configure(): void
-    {
-        $this->setHelp('Some help text');
-    }
 }

InvokableCommandInputAttributeRector

Change Symfony Command with execute() + configure() to __invoke() with attributes

-use Symfony\Component\Console\Attribute\AsCommand;
 use Symfony\Component\Console\Command\Command;
-use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Command\Argument;
+use Symfony\Component\Console\Command\Option;

-#[AsCommand(name: 'some_name')]
-final class SomeCommand extends Command
+final class SomeCommand
 {
-    public function configure()
-    {
-        $this->addArgument('argument', InputArgument::REQUIRED, 'Argument description');
-        $this->addOption('option', 'o', InputOption::VALUE_NONE, 'Option description');
-    }
-
-    public function execute(InputInterface $input, OutputInterface $output)
-    {
-        $someArgument = $input->getArgument('argument');
-        $someOption = $input->getOption('option');
+    public function __invoke(
+        #[Argument(name: 'argument', mode: Argument::REQUIRED, description: 'Argument description')]
+        string $argument,
+        #[Option]
+        bool $option = false,
+    ) {
+        $someArgument = $argument;
+        $someOption = $option;

         // ...

         return 1;
     }
 }