From 896dd54497b018b17a739b04b86a6f691a1cb896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Sat, 25 Nov 2023 10:46:26 +0100 Subject: [PATCH] fix config --- requirement-checker/rector-src.php | 15 ++++++--------- requirement-checker/rector-tests.php | 18 ++++++++++-------- requirement-checker/rector.php | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 requirement-checker/rector.php diff --git a/requirement-checker/rector-src.php b/requirement-checker/rector-src.php index ddf482591..ed8d99de4 100644 --- a/requirement-checker/rector-src.php +++ b/requirement-checker/rector-src.php @@ -6,20 +6,17 @@ use Rector\Set\ValueObject\DowngradeLevelSetList; use Rector\Set\ValueObject\LevelSetList; -return static function (RectorConfig $rectorConfig): void { +$applyCommonConfig = require __DIR__.'/rector.php'; + +return static function (RectorConfig $rectorConfig) use ($applyCommonConfig): void { + $applyCommonConfig($rectorConfig); + $rectorConfig->paths([ __DIR__ . '/src', ]); - $rectorConfig->autoloadPaths([ - __DIR__ . '/vendor/autoload.php', - __DIR__ . '/../vendor-bin/rector/vendor/autoload.php', - ]); - - $rectorConfig->importNames(); - $rectorConfig->sets([ - // TODO + LevelSetList::UP_TO_PHP_72, // DowngradeLevelSetList::DOWN_TO_PHP_72, ]); }; diff --git a/requirement-checker/rector-tests.php b/requirement-checker/rector-tests.php index adda3dbce..022c82102 100644 --- a/requirement-checker/rector-tests.php +++ b/requirement-checker/rector-tests.php @@ -3,21 +3,23 @@ declare(strict_types=1); use Rector\Config\RectorConfig; +use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector; use Rector\Set\ValueObject\LevelSetList; -return static function (RectorConfig $rectorConfig): void { +$applyCommonConfig = require __DIR__.'/rector.php'; + +return static function (RectorConfig $rectorConfig) use ($applyCommonConfig): void { + $applyCommonConfig($rectorConfig); + $rectorConfig->paths([ __DIR__ . '/tests', ]); - $rectorConfig->autoloadPaths([ - __DIR__ . '/vendor/autoload.php', - __DIR__ . '/../vendor-bin/rector/vendor/autoload.php', - ]); - - $rectorConfig->importNames(); - $rectorConfig->sets([ LevelSetList::UP_TO_PHP_82, ]); + + $rectorConfig->skip([ + ClosureToArrowFunctionRector::class + ]); }; diff --git a/requirement-checker/rector.php b/requirement-checker/rector.php new file mode 100644 index 000000000..55b3259b4 --- /dev/null +++ b/requirement-checker/rector.php @@ -0,0 +1,17 @@ +autoloadPaths([ + __DIR__ . '/vendor/autoload.php', + __DIR__ . '/../vendor-bin/rector/vendor/autoload.php', + ]); + + $rectorConfig->importNames(); +};