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-08-26 12:54:53 +02:00
|
|
|
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;
|
2020-08-26 12:54:53 +02:00
|
|
|
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', [[
|
2020-08-26 12:54:53 +02:00
|
|
|
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-08-19 18:00:27 +02:00
|
|
|
]]);
|
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,
|
2020-07-26 15:42:17 +02:00
|
|
|
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/*',
|
2020-08-24 23:25:26 +02:00
|
|
|
// 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
|
|
|
};
|