From a6e3107b13a91633a2d6a154a697ddbe1c37e207 Mon Sep 17 00:00:00 2001 From: Christopher Georg Date: Sun, 7 Apr 2024 15:07:36 +0200 Subject: [PATCH] chore: upgrade rector 0.x to 1 remove old rector rules --- composer.json | 2 +- rector.php | 25 +------------------------ 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 26a03c7..f0a9598 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require-dev": { "phpunit/phpunit": "^7.5 | ^8.0 | ^9.0", - "rector/rector": "^0.13.6", + "rector/rector": "^1.0.4", "symplify/easy-coding-standard": "^11.0", "vimeo/psalm": "^4.24" }, diff --git a/rector.php b/rector.php index 6d20eb5..26fc203 100644 --- a/rector.php +++ b/rector.php @@ -3,18 +3,10 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Nette\Set\NetteSetList; -use Rector\Set\ValueObject\SetList; -use Rector\Core\Configuration\Option; use Rector\Symfony\Set\SymfonySetList; use Rector\Doctrine\Set\DoctrineSetList; use Rector\Set\ValueObject\LevelSetList; -use Rector\Symfony\Set\SensiolabsSetList; -use Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector; use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector; -use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector; -use Rector\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector; -use Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector; use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector; @@ -24,27 +16,18 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector; use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector; use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector; -use Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictBoolReturnExprRector; -use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeFuncCallRector; - return static function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ __DIR__ . '/lib' ]); - $parameters = $rectorConfig->parameters(); - $parameters->set( - Option::SYMFONY_CONTAINER_XML_PATH_PARAMETER, - __DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml' - ); + $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml'); $rectorConfig->sets([ DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES, - NetteSetList::ANNOTATIONS_TO_ATTRIBUTES, - SensiolabsSetList::FRAMEWORK_EXTRA_61, SymfonySetList::SYMFONY_60, LevelSetList::UP_TO_PHP_81 ]); @@ -53,21 +36,15 @@ $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); $rectorConfig->rule(AddReturnTypeDeclarationRector::class); $rectorConfig->rules([ - AddArrayParamDocTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, AddVoidReturnTypeWhereNoReturnRector::class, - ArrayShapeFromConstantArrayReturnRector::class, ParamTypeByMethodCallTypeRector::class, ParamTypeByParentCallTypeRector::class, - ParamTypeDeclarationRector::class, - PropertyTypeDeclarationRector::class, RemoveUselessParamTagRector::class, ReturnTypeFromReturnNewRector::class, ReturnTypeFromStrictBoolReturnExprRector::class, - ReturnTypeFromStrictNativeFuncCallRector::class, ReturnTypeFromStrictNewArrayRector::class, TypedPropertyFromAssignsRector::class, - VarConstantCommentRector::class ]); // define sets of rules