rector/rector.php

45 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\Generic\ValueObject\NamespacePrefixWithExcludedClasses;
use Rector\SymfonyPhpConfig\Rector\ArrayItem\ReplaceArrayWithObjectRector;
2020-07-18 20:26:57 +02:00
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ReplaceArrayWithObjectRector::class)
->call('configure', [[
ReplaceArrayWithObjectRector::CONSTANT_NAMES_TO_VALUE_OBJECTS => [
'Rector\Generic\Rector\Name\PseudoNamespaceToNamespaceRector::NAMESPACE_PREFIXES_WITH_EXCLUDED_CLASSES' => NamespacePrefixWithExcludedClasses::class,
],
]]);
2020-07-18 20:26:57 +02:00
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
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/*',
2020-07-30 01:39:41 +02:00
__DIR__ . '/packages/rector-generator/templates/*',
2020-07-27 11:26:41 +02:00
'*.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');
};