rector/rector-ci.php

60 lines
2.0 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;
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 {
$services = $containerConfigurator->services();
$services->set(ReturnArrayClassMethodToYieldRector::class)
2020-07-16 20:59:54 +02:00
->arg('$methodsByType', [
TestCase::class => ['provideData', 'provideData*', 'dataProvider', '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::SYMFONY_PHP_CONFIG,
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',
]);
$parameters->set(Option::AUTOLOAD_PATHS, [__DIR__ . '/compiler/src']);
$parameters->set(Option::EXCLUDE_PATHS, [
'/Fixture/', '/Source/', '/Expected/', __DIR__ . '/packages/doctrine-annotation-generated/src/*',
]);
$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
};