rector/rector-ci.php

65 lines
2.2 KiB
PHP
Raw Normal View History

2020-07-16 20:47:09 +02:00
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\String_\SplitStringClassConstantToClassConstFetchRector;
2020-07-16 20:59:54 +02:00
use Rector\Core\Configuration\Option;
use Rector\DeadCode\Rector\ClassConst\RemoveUnusedClassConstantRector;
2020-07-16 20:47:09 +02:00
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
2020-07-20 14:18:15 +02:00
use Rector\Set\ValueObject\SetList;
2020-07-18 11:24:54 +02:00
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
2020-07-16 20:47:09 +02:00
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
2020-07-16 20:59:54 +02:00
$parameters->set(Option::SETS, [
2020-07-20 14:18:15 +02:00
SetList::CODING_STYLE,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::NETTE_UTILS_CODE_QUALITY,
SetList::SOLID,
SetList::PRIVATIZATION,
SetList::NAMING,
SetList::ORDER,
2020-08-01 21:36:47 +02:00
SetList::DEFLUENT,
SetList::TYPE_DECLARATION,
SetList::PHPUNIT_CODE_QUALITY,
2020-07-16 20:59:54 +02:00
]);
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/rules',
__DIR__ . '/packages',
__DIR__ . '/tests',
__DIR__ . '/utils',
__DIR__ . '/compiler/src',
__DIR__ . '/compiler/bin/compile',
__DIR__ . '/compiler/build/scoper.inc.php',
__DIR__ . '/config/set',
]);
2020-08-22 19:13:13 +02:00
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
2020-07-16 20:59:54 +02:00
$parameters->set(Option::AUTOLOAD_PATHS, [__DIR__ . '/compiler/src']);
$parameters->set(Option::EXCLUDE_PATHS, [
2020-07-28 17:15:30 +02:00
'/Fixture/', '/Source/', '/Expected/',
__DIR__ . '/packages/doctrine-annotation-generated/src/*',
// tempalte files
__DIR__ . '/packages/rector-generator/templates/*',
// public api
__DIR__ . '/packages/rector-generator/src/ValueObject/RectorRecipe.php',
__DIR__ . '/rules/symfony-php-config/functions/functions.php',
2020-07-16 20:59:54 +02:00
]);
$parameters->set(Option::EXCLUDE_RECTORS, [
StringClassNameToClassConstantRector::class,
SplitStringClassConstantToClassConstFetchRector::class,
// false positives on constants used in rector-ci.php
RemoveUnusedClassConstantRector::class,
]);
# so Rector code is still PHP 7.2 compatible
$parameters->set(Option::PHP_VERSION_FEATURES, '7.2');
2020-07-16 20:47:09 +02:00
};