Run Rector on your code to see what it can do for you:
<?php use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Style\SymfonyStyle; #[AsCommand('app:my-command')] -final class MyCommand extends Command +final class MyCommand { - #[\Override] - protected function execute(InputInterface $input, OutputInterface $output): int - { - $io = new SymfonyStyle($input, $output); - $io->info('Great success!'); - - return 1; + public function __invoke(OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + $io->info('Great success!'); + return 1; } }
Applied Rules:
Not a change you expect?
rector.php