Find the best Rector rule to solve your problem. Searching through 823 rules.
Found 2 rules:
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';
- }
}
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');
- }
}