Change $services->set(..., ...) to $services->load(..., ...) where meaningful
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
-use App\Services\FistService;
-use App\Services\SecondService;
-
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$services = $containerConfigurator->services();
- $services->set(FistService::class);
- $services->set(SecondService::class);
+ $services->load('App\\Services\\', '../src/Services/*');
};
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Configs\Rector\Closure\ServiceSettersToSettersAutodiscoveryRector;
return RectorConfig::configure()
->withRules([
ServiceSettersToSettersAutodiscoveryRector::class,
]);