rector/config/set/kdyby-to-symfony.php
2020-08-24 22:37:12 +00:00

46 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
use Rector\Generic\Rector\ClassMethod\ChangeMethodVisibilityRector;
use Rector\NetteToSymfony\Rector\MethodCall\WrapTransParameterNameRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use function Rector\SymfonyPhpConfig\inline_value_objects;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeMethodVisibilityRector::class)
->call('configure', [[
ChangeMethodVisibilityRector::METHOD_TO_VISIBILITY_BY_CLASS => [
'Kdyby\Events\Subscriber' => [
'getSubscribedEvents' => 'static',
],
],
]]);
$services->set(RenameMethodRector::class)
->call('configure', [[
RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([
new MethodCallRename('Kdyby\Translation\Translator', 'translate', 'trans'),
new MethodCallRename('Kdyby\RabbitMq\IConsumer', 'process', 'execute'),
]),
]]);
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
'Kdyby\RabbitMq\IConsumer' => 'OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface',
'Kdyby\RabbitMq\IProducer' => 'OldSound\RabbitMqBundle\RabbitMq\ProducerInterface',
'Kdyby\Monolog\Logger' => 'Psr\Log\LoggerInterface',
'Kdyby\Events\Subscriber' => 'Symfony\Component\EventDispatcher\EventSubscriberInterface',
'Kdyby\Translation\Translator' => 'Symfony\Contracts\Translation\TranslatorInterface',
],
]]);
$services->set(WrapTransParameterNameRector::class);
};