-
-
Notifications
You must be signed in to change notification settings - Fork 723
Open
Labels
Description
Bug Report
Subject | Details |
---|---|
Rector version | last dev-main |
Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/7268bb7d-7a4f-4485-b43e-c5cb83a4c65b
<?php
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand('app:my-command')]
final class MyCommand extends Command
{
#[\Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$io->info('Great success!');
return 1;
}
}
Responsible rules
InvokableCommandInputAttributeRector
Expected Behavior
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(\Symfony\Component\Console\Style\SymfonyStyle $io): int
+ {
+ $io->info('Great success!');
+ return 1;
}
}