2020-07-18 18:57:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
use Rector\Doctrine\Rector\Class_\ManagerRegistryGetManagerToEntityManagerRector;
|
|
|
|
use Rector\DoctrineCodeQuality\Rector\Class_\InitializeDefaultEntityCollectionRector;
|
2020-08-17 13:21:59 +02:00
|
|
|
use Rector\DoctrineCodeQuality\Rector\Class_\MoveCurrentDateTimeDefaultInEntityToConstructorRector;
|
2020-11-04 22:51:11 +01:00
|
|
|
use Rector\DoctrineCodeQuality\Rector\Class_\RemoveRedundantDefaultClassAnnotationValuesRector;
|
2020-08-17 13:21:59 +02:00
|
|
|
use Rector\DoctrineCodeQuality\Rector\ClassMethod\MakeEntityDateTimePropertyDateTimeInterfaceRector;
|
|
|
|
use Rector\DoctrineCodeQuality\Rector\ClassMethod\MakeEntitySetterNullabilityInSyncWithPropertyRector;
|
|
|
|
use Rector\DoctrineCodeQuality\Rector\Property\ChangeBigIntEntityPropertyToIntTypeRector;
|
2020-08-25 00:26:14 +02:00
|
|
|
use Rector\DoctrineCodeQuality\Rector\Property\CorrectDefaultTypesOnEntityPropertyRector;
|
2020-10-18 18:29:35 +02:00
|
|
|
use Rector\DoctrineCodeQuality\Rector\Property\ImproveDoctrineCollectionDocTypeInEntityRector;
|
2020-11-04 22:51:11 +01:00
|
|
|
use Rector\DoctrineCodeQuality\Rector\Property\RemoveRedundantDefaultPropertyAnnotationValuesRector;
|
2021-01-21 19:42:03 +02:00
|
|
|
use Rector\Privatization\Rector\MethodCall\ReplaceStringWithClassConstantRector;
|
|
|
|
use Rector\Privatization\ValueObject\ReplaceStringWithClassConstant;
|
2021-03-14 22:05:32 +01:00
|
|
|
use Rector\Transform\Rector\MethodCall\ServiceGetterToConstructorInjectionRector;
|
|
|
|
use Rector\Transform\ValueObject\ServiceGetterToConstructorInjection;
|
2020-07-18 18:57:24 +02:00
|
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
2021-01-21 19:42:03 +02:00
|
|
|
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
|
|
$services = $containerConfigurator->services();
|
|
|
|
$services->set(ManagerRegistryGetManagerToEntityManagerRector::class);
|
|
|
|
$services->set(InitializeDefaultEntityCollectionRector::class);
|
2020-08-17 13:21:59 +02:00
|
|
|
$services->set(MakeEntitySetterNullabilityInSyncWithPropertyRector::class);
|
|
|
|
$services->set(MakeEntityDateTimePropertyDateTimeInterfaceRector::class);
|
|
|
|
$services->set(MoveCurrentDateTimeDefaultInEntityToConstructorRector::class);
|
|
|
|
$services->set(CorrectDefaultTypesOnEntityPropertyRector::class);
|
|
|
|
$services->set(ChangeBigIntEntityPropertyToIntTypeRector::class);
|
2020-10-18 18:29:35 +02:00
|
|
|
$services->set(ImproveDoctrineCollectionDocTypeInEntityRector::class);
|
2020-11-04 22:51:11 +01:00
|
|
|
$services->set(RemoveRedundantDefaultPropertyAnnotationValuesRector::class);
|
|
|
|
$services->set(RemoveRedundantDefaultClassAnnotationValuesRector::class);
|
2021-01-21 19:42:03 +02:00
|
|
|
$services->set(ReplaceStringWithClassConstantRector::class)
|
2021-02-14 22:28:21 +01:00
|
|
|
->call('configure', [[
|
|
|
|
ReplaceStringWithClassConstantRector::REPLACE_STRING_WITH_CLASS_CONSTANT => ValueObjectInliner::inline([
|
|
|
|
new ReplaceStringWithClassConstant(
|
|
|
|
'Doctrine\ORM\QueryBuilder',
|
|
|
|
'orderBy',
|
|
|
|
1,
|
|
|
|
'Doctrine\Common\Collections\Criteria'
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
]]);
|
2021-03-14 22:05:32 +01:00
|
|
|
|
|
|
|
$services->set(ServiceGetterToConstructorInjectionRector::class)
|
|
|
|
->call('configure', [[
|
|
|
|
ServiceGetterToConstructorInjectionRector::METHOD_CALL_TO_SERVICES => ValueObjectInliner::inline([
|
|
|
|
new ServiceGetterToConstructorInjection(
|
|
|
|
'Doctrine\Common\Persistence\ManagerRegistry',
|
|
|
|
'getConnection',
|
|
|
|
'Doctrine\DBAL\Connection'
|
|
|
|
),
|
|
|
|
new ServiceGetterToConstructorInjection(
|
|
|
|
'Doctrine\ORM\EntityManagerInterface',
|
|
|
|
'getConfiguration',
|
|
|
|
'Doctrine\ORM\Configuration'
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
};
|