67 lines
3.6 KiB
PHP
67 lines
3.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Rector\Core\Configuration\Option;
|
|
use Rector\Doctrine\Set\DoctrineSetList;
|
|
use Rector\Set\ValueObject\LevelSetList;
|
|
use Rector\Symfony\Set\SymfonyLevelSetList;
|
|
use Rector\Symfony\Set\SymfonySetList;
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
$parameters = $containerConfigurator->parameters();
|
|
$parameters->set(Option::AUTO_IMPORT_NAMES, TRUE);
|
|
$parameters->set(Option::IMPORT_SHORT_CLASSES, TRUE);
|
|
$parameters->set(Option::SKIP, [
|
|
Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class,
|
|
]);
|
|
|
|
$containerConfigurator->import(DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES);
|
|
$containerConfigurator->import(SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES);
|
|
$containerConfigurator->import(LevelSetList::UP_TO_PHP_81);
|
|
$containerConfigurator->import(SymfonyLevelSetList::UP_TO_SYMFONY_60);
|
|
|
|
// get services (needed for register a single rule)
|
|
$services = $containerConfigurator->services();
|
|
|
|
foreach ([
|
|
Rector\CodeQuality\Rector\BooleanNot\SimplifyDeMorganBinaryRector::class,
|
|
Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class,
|
|
Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector::class,
|
|
Rector\CodeQuality\Rector\For_\ForToForeachRector::class,
|
|
Rector\CodeQuality\Rector\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class,
|
|
Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector::class,
|
|
Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector::class,
|
|
Rector\CodeQuality\Rector\Ternary\SimplifyDuplicatedTernaryRector::class,
|
|
Rector\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector::class,
|
|
Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector::class,
|
|
Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector::class,
|
|
Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector::class,
|
|
Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector::class,
|
|
Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector::class,
|
|
Rector\CodingStyle\Rector\FuncCall\CallUserFuncArrayToVariadicRector::class,
|
|
Rector\CodingStyle\Rector\FuncCall\CallUserFuncToMethodCallRector::class,
|
|
Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector::class,
|
|
Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector::class,
|
|
Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector::class,
|
|
Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector::class,
|
|
Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector::class,
|
|
Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector::class,
|
|
Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector::class,
|
|
Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector::class,
|
|
Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector::class,
|
|
Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector::class,
|
|
Rector\Restoration\Rector\Property\MakeTypedPropertyNullableIfCheckedRector::class,
|
|
Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector::class,
|
|
Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector::class,
|
|
Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector::class,
|
|
Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector::class,
|
|
Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector::class,
|
|
Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector::class,
|
|
Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class,
|
|
] as $rule) {
|
|
$services->set($rule);
|
|
}
|
|
};
|