mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
d5bf66f9cd
* [CI] run rules dir by dir to identify static reflection weak sposts * [ci-review] Rector Rectify * consistency * remove unused property * add data provider test fixture * add InvertedIfFactory to lower complexity * [DeadCode] Skip unused public method if data provider * misc * [DeadCode] Do not remove class method if required by parent ocntract * make use of ContextAnalyzer to find the loop * narrow dirs one level * narrow packages * narrow * use directly * narrow * correct constant name to keep BC * bump deps * add version_compare to removed extra params, just to be sure * do not return function node on unchanged name * narrow * add support for multiple variants * widen * remove double check [skip ci] Co-authored-by: kaizen-ci <info@kaizen-ci.org>
96 lines
3.4 KiB
PHP
96 lines
3.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Rector\CodingStyle\Rector\MethodCall\PreferThisOrSelfMethodCallRector;
|
|
use Rector\CodingStyle\Rector\String_\SplitStringClassConstantToClassConstFetchRector;
|
|
use Rector\Core\Configuration\Option;
|
|
use Rector\Core\Rector\AbstractRector;
|
|
use Rector\Core\ValueObject\PhpVersion;
|
|
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
|
use Rector\Privatization\Rector\Property\PrivatizeLocalPropertyToPrivatePropertyRector;
|
|
use Rector\Restoration\Rector\ClassMethod\InferParamFromClassMethodReturnRector;
|
|
use Rector\Restoration\ValueObject\InferParamFromClassMethodReturn;
|
|
use Rector\Set\ValueObject\SetList;
|
|
use Rector\SymfonyPhpConfig\Rector\MethodCall\AutoInPhpSymfonyConfigRector;
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
$services = $containerConfigurator->services();
|
|
|
|
$configuration = ValueObjectInliner::inline([
|
|
new InferParamFromClassMethodReturn(AbstractRector::class, 'refactor', 'getNodeTypes'),
|
|
]);
|
|
$services->set(InferParamFromClassMethodReturnRector::class)
|
|
->call('configure', [[
|
|
InferParamFromClassMethodReturnRector::INFER_PARAMS_FROM_CLASS_METHOD_RETURNS => $configuration,
|
|
]]);
|
|
|
|
$services->set(PreferThisOrSelfMethodCallRector::class)
|
|
->call('configure', [[
|
|
PreferThisOrSelfMethodCallRector::TYPE_TO_PREFERENCE => [
|
|
TestCase::class => PreferThisOrSelfMethodCallRector::PREFER_THIS,
|
|
],
|
|
]]);
|
|
|
|
$services->set(AutoInPhpSymfonyConfigRector::class);
|
|
|
|
$parameters = $containerConfigurator->parameters();
|
|
|
|
$parameters->set(Option::SETS, [
|
|
SetList::CODING_STYLE,
|
|
SetList::CODE_QUALITY,
|
|
SetList::CODE_QUALITY_STRICT,
|
|
SetList::DEAD_CODE,
|
|
SetList::DEAD_CODE_STRICT,
|
|
SetList::DEAD_DOC_BLOCK,
|
|
SetList::NETTE_UTILS_CODE_QUALITY,
|
|
SetList::PRIVATIZATION,
|
|
SetList::NAMING,
|
|
SetList::DEFLUENT,
|
|
SetList::TYPE_DECLARATION,
|
|
SetList::PHPUNIT_CODE_QUALITY,
|
|
SetList::SYMFONY_AUTOWIRE,
|
|
SetList::PHP_71,
|
|
SetList::PHP_72,
|
|
SetList::PHP_73,
|
|
SetList::EARLY_RETURN,
|
|
SetList::TYPE_DECLARATION_STRICT,
|
|
]);
|
|
|
|
$parameters->set(Option::PATHS, [
|
|
__DIR__ . '/src',
|
|
__DIR__ . '/rules',
|
|
__DIR__ . '/packages',
|
|
__DIR__ . '/tests',
|
|
__DIR__ . '/utils',
|
|
__DIR__ . '/config/set',
|
|
]);
|
|
|
|
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
|
|
|
|
$parameters->set(Option::SKIP, [
|
|
StringClassNameToClassConstantRector::class,
|
|
SplitStringClassConstantToClassConstFetchRector::class,
|
|
|
|
PrivatizeLocalPropertyToPrivatePropertyRector::class => [
|
|
__DIR__ . '/src/Rector/AbstractTemporaryRector.php',
|
|
],
|
|
|
|
// test paths
|
|
'*/Fixture/*',
|
|
'*/Source/*',
|
|
'*/Expected/*',
|
|
|
|
__DIR__ . '/packages/doctrine-annotation-generated/src',
|
|
// template files
|
|
__DIR__ . '/packages/rector-generator/templates',
|
|
__DIR__ . '/packages/rector-generator/src/ValueObject/RectorRecipe.php',
|
|
]);
|
|
|
|
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_73);
|
|
$parameters->set(Option::ENABLE_CACHE, true);
|
|
};
|