Replace defined service() argument in Symfony PHP config
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
-return service(ContainerInterface::class);
+return service('service_container');
Configure your rector.php
:
<?php
use PhpParser\Node\Scalar\String_;
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony60\Rector\FuncCall\ReplaceServiceArgumentRector;
use Rector\Symfony\ValueObject\ReplaceServiceArgument;
return RectorConfig::configure()
->withConfiguredRule(ReplaceServiceArgumentRector::class, [
new ReplaceServiceArgument('ContainerInterface', new String_('service_container')),
]);