From 30b36b6a9d5920412a4b9d64bfc033308d868bdc Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 18 Feb 2024 00:23:41 +0000 Subject: [PATCH] Updated Rector to commit b621800bef5b820ef28b3d90d670b3f644e0c808 https://github.com/rectorphp/rector-src/commit/b621800bef5b820ef28b3d90d670b3f644e0c808 [Transform] Allow transform autoloadPaths() to withAutoloadPaths() on RectorConfigBuilderRector (#5630) --- .../FileWithoutNamespace/RectorConfigBuilderRector.php | 10 +++++++++- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rules/Transform/Rector/FileWithoutNamespace/RectorConfigBuilderRector.php b/rules/Transform/Rector/FileWithoutNamespace/RectorConfigBuilderRector.php index 8229a41e42c..8b47f0698d8 100644 --- a/rules/Transform/Rector/FileWithoutNamespace/RectorConfigBuilderRector.php +++ b/rules/Transform/Rector/FileWithoutNamespace/RectorConfigBuilderRector.php @@ -74,6 +74,7 @@ CODE_SAMPLE $rules = new Array_(); $paths = new Array_(); $skips = new Array_(); + $autoloadPaths = new Array_(); foreach ($stmts as $rectorConfigStmt) { // complex stmts should be skipped, eg: with if else if (!$rectorConfigStmt instanceof Expression) { @@ -95,7 +96,7 @@ CODE_SAMPLE $name = $this->getName($rectorConfigStmt->expr->name); if ($name === 'rule') { Assert::isAOf($rules, Array_::class); - $rules->items[] = new ArrayItem($rectorConfigStmt->expr->getArgs()[0]->value); + $rules->items[] = new ArrayItem($value); } elseif ($name === 'rules') { if ($value instanceof Array_) { Assert::isAOf($rules, Array_::class); @@ -107,6 +108,9 @@ CODE_SAMPLE $paths = $value; } elseif ($name === 'skip') { $skips = $value; + } elseif ($name === 'autoloadPaths') { + Assert::isAOf($value, Array_::class); + $autoloadPaths = $value; } else { // implementing method by method return null; @@ -124,6 +128,10 @@ CODE_SAMPLE $newExpr = $this->nodeFactory->createMethodCall($newExpr, 'withRules', [$rules]); $hasChanged = \true; } + if ($autoloadPaths->items !== []) { + $newExpr = $this->nodeFactory->createMethodCall($newExpr, 'withAutoloadPaths', [$autoloadPaths]); + $hasChanged = \true; + } if ($hasChanged) { $stmt->expr = $newExpr; } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 9f16c34b50e..008a0c576d0 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = 'a533e70fca40571ab9504fbb857205b2be2eccb6'; + public const PACKAGE_VERSION = 'b621800bef5b820ef28b3d90d670b3f644e0c808'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-02-17 11:56:55'; + public const RELEASE_DATE = '2024-02-18 07:21:31'; /** * @var int */