From 847639a452bb65ff8be0955d50ddf02f343ae099 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 18 May 2024 09:14:04 +0700 Subject: [PATCH] Bump to Rector 1.0 (#205) * Bump to Rector 1.0 * re-run rector * skip scoper.php * skip scoper.php --- composer.json | 2 +- rector.php | 46 +++++++++++++++++----------------------------- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/composer.json b/composer.json index ac1b5a36d6..bbd215da2f 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^10.5", - "rector/rector": "^0.19", + "rector/rector": "^1.0", "symplify/phpstan-extensions": "^11.4", "symplify/vendor-patches": "^11.3", "tomasvotruba/class-leak": "^0.2", diff --git a/rector.php b/rector.php index 365ecae88b..2e98a86f88 100644 --- a/rector.php +++ b/rector.php @@ -4,39 +4,27 @@ use Rector\Config\RectorConfig; use Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector; -use Rector\Set\ValueObject\LevelSetList; -use Rector\Set\ValueObject\SetList; -return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_82, - SetList::CODE_QUALITY, - SetList::DEAD_CODE, - SetList::CODING_STYLE, - SetList::TYPE_DECLARATION, - SetList::NAMING, - SetList::PRIVATIZATION, - SetList::EARLY_RETURN, - ]); - - $rectorConfig->paths([ - __DIR__ . '/ecs.php', - __DIR__ . '/rector.php', - __DIR__ . '/config', - __DIR__ . '/src', - __DIR__ . '/config', - __DIR__ . '/tests', - ]); - - $rectorConfig->importNames(); - - $rectorConfig->bootstrapFiles([__DIR__ . '/tests/bootstrap.php']); - - $rectorConfig->skip([ +return RectorConfig::configure() + ->withPhpSets(php82: true) + ->withPreparedSets( + codeQuality: true, + deadCode: true, + codingStyle: true, + typeDeclarations: true, + naming: true, + privatization: true, + earlyReturn: true + ) + ->withPaths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/config', __DIR__ . '/tests']) + ->withRootFiles() + ->withImportNames() + ->withBootstrapFiles([__DIR__ . '/tests/bootstrap.php']) + ->withSkip([ '*/Source/*', '*/Fixture/*', __DIR__ . '/src/SniffRunner/ValueObject/File.php', + __DIR__ . '/scoper.php', RenameParamToMatchTypeRector::class => [__DIR__ . '/src/FixerRunner/Application/FixerFileProcessor.php'], ]); -};