rector/rector.php

52 lines
1.5 KiB
PHP
Raw Normal View History

2020-07-18 20:26:57 +02:00
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Core\Contract\Rector\RectorInterface;
2020-07-20 14:18:15 +02:00
use Rector\Set\ValueObject\SetList;
use Rector\SymfonyPhpConfig\Rector\MethodCall\ChangeCallByNameToConstantByClassRector;
2020-07-18 20:26:57 +02:00
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/create-rector.php', null, 'not_found');
$services = $containerConfigurator->services();
$services->set(ChangeCallByNameToConstantByClassRector::class)
->call('configure', [
[
ChangeCallByNameToConstantByClassRector::CLASS_TYPES_TO_METHOD_NAME => [
RectorInterface::class => 'configure',
],
],
]);
2020-07-18 20:26:57 +02:00
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
2020-07-20 14:18:15 +02:00
$parameters->set(Option::SETS, [SetList::NAMING]);
2020-07-19 23:36:10 +02:00
2020-07-27 11:26:41 +02:00
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/rules',
__DIR__ . '/utils',
__DIR__ . '/packages',
__DIR__ . '/bin/rector',
]);
$parameters->set(Option::EXCLUDE_PATHS, [
'/Source/',
'/*Source/',
'/Fixture/',
'/Expected/',
__DIR__ . '/packages/doctrine-annotation-generated/src/*',
'*.php.inc',
]);
2020-07-18 20:26:57 +02:00
# so Rector code is still PHP 7.2 compatible
$parameters->set(Option::PHP_VERSION_FEATURES, '7.2');
};