Skip to content

Commit

Permalink
Updated Rector to commit 21aa474269373c93fa8d74e72e7e8ee817a38cee
Browse files Browse the repository at this point in the history
rectorphp/rector-src@21aa474 Fix configured rule (#5517)
  • Loading branch information
TomasVotruba committed Jan 29, 2024
1 parent 5c1dd52 commit 7c6043c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Config/RectorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function phpstanConfigs(array $filePaths) : void
SimpleParameterProvider::addParameter(Option::PHPSTAN_FOR_RECTOR_PATHS, $filePaths);
}
/**
* @param class-string<ConfigurableRectorInterface&RectorInterface> $rectorClass
* @param class-string<ConfigurableRectorInterface> $rectorClass
* @param mixed[] $configuration
*/
public function ruleWithConfiguration(string $rectorClass, array $configuration) : void
Expand Down
15 changes: 9 additions & 6 deletions src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,9 +38,9 @@ final class RectorConfigBuilder
*/
private $rules = [];
/**
* @var array<class-string<RectorInterface>, mixed[]>
* @var array<class-string<ConfigurableRectorInterface>, mixed[]>
*/
private $rulesWithConfiguration = [];
private $rulesWithConfigurations = [];
/**
* @var string[]
*/
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -301,12 +304,12 @@ public function withCache(?string $cacheDirectory = null, ?string $cacheClass =
return $this;
}
/**
* @param class-string<(RectorInterface)> $rectorClass
* @param class-string<ConfigurableRectorInterface> $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
Expand Down

0 comments on commit 7c6043c

Please sign in to comment.