Converts order-dependent arguments args() to named arg() call
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(SomeClass::class)
- ->args(['some_value']);
+ ->arg('$someCtorParameter', 'some_value');
};
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Configs\Rector\Closure\ServiceArgsToServiceNamedArgRector;
return RectorConfig::configure()
->withRules([
ServiceArgsToServiceNamedArgRector::class,
]);