CommandSetCodeClosureTypesRector
Add input/output param types and int return type to closure passed to Command::setCode()
-$command->setCode(function ($input, $output) {
+$command->setCode(function (\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output): int {
$output->writeln('hello');
+ return \Symfony\Component\Console\Command\Command::SUCCESS;
});
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony73\Rector\MethodCall\CommandSetCodeClosureTypesRector;
return RectorConfig::configure()
->withRules([
CommandSetCodeClosureTypesRector::class,
]);
PACKAGE:
symfony/console >=7.3