From 7c6043c26c0a89abd03ee9d94ce5e9c7ca936dd8 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 29 Jan 2024 21:10:17 +0000 Subject: [PATCH] Updated Rector to commit 21aa474269373c93fa8d74e72e7e8ee817a38cee https://github.com/rectorphp/rector-src/commit/21aa474269373c93fa8d74e72e7e8ee817a38cee Fix configured rule (#5517) --- src/Application/VersionResolver.php | 4 ++-- src/Config/RectorConfig.php | 2 +- src/Configuration/RectorConfigBuilder.php | 15 +++++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 6b7213b4a594..2fc2d6f2ab02 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 = '0.19.3'; + public const PACKAGE_VERSION = '0.19.4'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-01-29 17:16:20'; + public const RELEASE_DATE = '2024-01-29 22:07:54'; /** * @var int */ diff --git a/src/Config/RectorConfig.php b/src/Config/RectorConfig.php index a54af055e302..e34adf1370f8 100644 --- a/src/Config/RectorConfig.php +++ b/src/Config/RectorConfig.php @@ -141,7 +141,7 @@ public function phpstanConfigs(array $filePaths) : void SimpleParameterProvider::addParameter(Option::PHPSTAN_FOR_RECTOR_PATHS, $filePaths); } /** - * @param class-string $rectorClass + * @param class-string $rectorClass * @param mixed[] $configuration */ public function ruleWithConfiguration(string $rectorClass, array $configuration) : void diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index e81870416a03..0fec03b2efcb 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -5,6 +5,7 @@ use Rector\Caching\Contract\ValueObject\Storage\CacheStorageInterface; use Rector\Config\RectorConfig; +use Rector\Contract\Rector\ConfigurableRectorInterface; use Rector\Contract\Rector\RectorInterface; use Rector\Doctrine\Set\DoctrineSetList; use Rector\PHPUnit\Set\PHPUnitSetList; @@ -37,9 +38,9 @@ final class RectorConfigBuilder */ private $rules = []; /** - * @var array, mixed[]> + * @var array, mixed[]> */ - private $rulesWithConfiguration = []; + private $rulesWithConfigurations = []; /** * @var string[] */ @@ -127,8 +128,10 @@ public function __invoke(RectorConfig $rectorConfig) : void $rectorConfig->paths($this->paths); $rectorConfig->skip($this->skip); $rectorConfig->rules($this->rules); - foreach ($this->rulesWithConfiguration as $ruleWithConfiguration) { - $rectorConfig->ruleWithConfiguration($ruleWithConfiguration[0], $ruleWithConfiguration[1]); + foreach ($this->rulesWithConfigurations as $rectorClass => $configurations) { + foreach ($configurations as $configuration) { + $rectorConfig->ruleWithConfiguration($rectorClass, $configuration); + } } if ($this->fileExtensions !== []) { $rectorConfig->fileExtensions($this->fileExtensions); @@ -301,12 +304,12 @@ public function withCache(?string $cacheDirectory = null, ?string $cacheClass = return $this; } /** - * @param class-string<(RectorInterface)> $rectorClass + * @param class-string $rectorClass * @param mixed[] $configuration */ public function withConfiguredRule(string $rectorClass, array $configuration) : self { - $this->rulesWithConfiguration[$rectorClass] = $configuration; + $this->rulesWithConfigurations[$rectorClass][] = $configuration; return $this; } public function withParallel(?int $timeoutSeconds = null, ?int $maxNumberOfProcess = null, ?int $jobSize = null) : self