rector/rector-ci.php

76 lines
2.8 KiB
PHP
Raw Normal View History

2020-07-16 20:47:09 +02:00
<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
use Rector\CodingStyle\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector;
use Rector\CodingStyle\Rector\String_\SplitStringClassConstantToClassConstFetchRector;
use Rector\CodingStyle\ValueObject\MethodToYield;
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;
use function Rector\SymfonyPhpConfig\inline_value_objects;
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 {
$services = $containerConfigurator->services();
$services->set(ReturnArrayClassMethodToYieldRector::class)
2020-07-30 01:39:41 +02:00
->call('configure', [[
ReturnArrayClassMethodToYieldRector::METHODS_TO_YIELDS => inline_value_objects([
new MethodToYield(TestCase::class, 'provideData'),
new MethodToYield(TestCase::class, 'provideData*'),
new MethodToYield(TestCase::class, 'dataProvider'),
new MethodToYield(TestCase::class, 'dataProvider*'),
]),
]]);
2020-07-16 20:47:09 +02:00
$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,
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,
]);
2020-07-16 20:47:09 +02:00
};