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;
|
2020-07-20 00:52:12 +02:00
|
|
|
use Rector\Core\ValueObject\Set;
|
2020-07-16 20:59:54 +02:00
|
|
|
use Rector\DeadCode\Rector\ClassConst\RemoveUnusedClassConstantRector;
|
2020-07-16 20:47:09 +02:00
|
|
|
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
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 00:52:12 +02:00
|
|
|
Set::CODING_STYLE, Set::CODE_QUALITY, Set::DEAD_CODE, Set::NETTE_UTILS_CODE_QUALITY, Set::SOLID, Set::PRIVATIZATION, Set::NAMING, Set::DECOMPLEX,
|
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
|
|
|
};
|