Description
Issue with PHP Configuration of Symfony DI Container
Symfony allows me to specify only one parameter—the class of the registered service (for example:
php
$services->set(CamelCaseToSnakeCaseNameConverter::class);
).
However, I get an exception in the rule ServiceSettersToSettersAutodiscoveryRector, because set only takes one argument.
You might say, "Just add a second parameter." But I don’t want to duplicate the class name, especially since Symfony itself allows me to avoid it. I want to fully leverage Symfony's DI container and the power of Rector.
The issue occurs at line 122 in ServiceSettersToSettersAutodiscoveryRector. A preprocessing step is required if the service ID has not been explicitly specified.
Full exception message:
[ERROR] Could not process "/src/Resources/config/services.php" file, due
to:
"System error:
"Rector\Symfony\Configs\Rector\Closure\ServiceSettersToSettersAutodiscoveryRector::createServicesLoadMethodCall
(): Argument #1 ($sharedNamespace) must be of type string, null given, called in
vendor/rector/rector/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceSettersToSettersAutodisco
veryRector.php121"
Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On line: 206