rector/config/set/easy-admin-bundle20.php

30 lines
1.2 KiB
PHP
Raw Normal View History

2020-07-18 18:57:24 +02:00
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Symfony\Rector\MethodCall\GetToConstructorInjectionRector;
2020-07-18 18:57:24 +02:00
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
2020-07-18 19:00:36 +02:00
# https://github.com/EasyCorp/EasyAdminBundle/blob/master/UPGRADE-2.0.md
2020-07-18 18:57:24 +02:00
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
2020-07-18 19:00:36 +02:00
# first replace ->get("...") by constructor injection in every child of "EasyCorp\Bundle\EasyAdminBundle\AdminController"
2020-07-18 18:57:24 +02:00
$services->set(GetToConstructorInjectionRector::class)
->call('configure', [[
2020-07-30 01:39:41 +02:00
GetToConstructorInjectionRector::GET_METHOD_AWARE_TYPES => [
'EasyCorp\Bundle\EasyAdminBundle\AdminController',
],
]]);
2020-07-18 18:57:24 +02:00
$services->set(RenameClassRector::class)
->call('configure', [[
2020-07-30 01:39:41 +02:00
RenameClassRector::OLD_TO_NEW_CLASSES => [
# then rename the "EasyCorp\Bundle\EasyAdminBundle\AdminController" class
'EasyCorp\Bundle\EasyAdminBundle\AdminController' => 'EasyCorp\Bundle\EasyAdminBundle\EasyAdminController',
],
]]);
2020-07-18 18:57:24 +02:00
};