rector-symfony icon indicating copy to clipboard operation
rector-symfony copied to clipboard

Use Symfony Command constants for return of execute

Open johanadivare opened this issue 2 years ago • 2 comments

With https://github.com/rectorphp/rector-symfony/blob/main/docs/rector_rules_overview.md#consoleexecutereturnintrector we got explicit return type int but it is even nicer to use Symfony Command constants they also use it as example in there documentation see https://symfony.com/doc/current/console.html#creating-a-command

Example:

 use Symfony\Component\Console\Command\Command;

 class SomeCommand extends Command
 {
    public function execute(InputInterface $input, OutputInterface $output): int
     {
-        return 0;
+        return Command::SUCCESS;
     }
 }

If you say its a nice addition a new rule should be added as its not part off ConsoleExecuteReturnIntRector right?

johanadivare avatar Oct 03 '22 09:10 johanadivare

This would be great addition :+1:

TomasVotruba avatar Oct 03 '22 09:10 TomasVotruba

Okay i will work on this

johanadivare avatar Oct 03 '22 09:10 johanadivare

Fixed with https://github.com/rectorphp/rector-symfony/pull/256

johanadivare avatar Oct 31 '22 08:10 johanadivare