|
6 | 6 | use PhpParser\NodeVisitor; |
7 | 7 | use Rector\Bridge\SetProviderCollector; |
8 | 8 | use Rector\Bridge\SetRectorsResolver; |
| 9 | +use Rector\Caching\Contract\CacheMetaExtensionInterface; |
9 | 10 | use Rector\Caching\Contract\ValueObject\Storage\CacheStorageInterface; |
10 | 11 | use Rector\Composer\InstalledPackageResolver; |
11 | 12 | use Rector\Config\Level\CodeQualityLevel; |
@@ -82,6 +83,10 @@ final class RectorConfigBuilder |
82 | 83 | private ?string $cacheClass = null; |
83 | 84 | private ?string $cacheDirectory = null; |
84 | 85 | private ?string $containerCacheDirectory = null; |
| 86 | + /** |
| 87 | + * @var array<class-string<CacheMetaExtensionInterface>> |
| 88 | + */ |
| 89 | + private array $cacheMetaExtensions = []; |
85 | 90 | private ?bool $parallel = null; |
86 | 91 | private int $parallelTimeoutSeconds = 120; |
87 | 92 | private int $parallelMaxNumberOfProcess = Defaults::PARALLEL_MAX_NUMBER_OF_PROCESS; |
@@ -222,6 +227,9 @@ public function __invoke(RectorConfig $rectorConfig): void |
222 | 227 | if ($this->containerCacheDirectory !== null) { |
223 | 228 | $rectorConfig->containerCacheDirectory($this->containerCacheDirectory); |
224 | 229 | } |
| 230 | + foreach ($this->cacheMetaExtensions as $cacheMetaExtensionClass) { |
| 231 | + $rectorConfig->cacheMetaExtension($cacheMetaExtensionClass); |
| 232 | + } |
225 | 233 | if ($this->importNames || $this->importDocBlockNames) { |
226 | 234 | $rectorConfig->importNames($this->importNames, $this->importDocBlockNames); |
227 | 235 | $rectorConfig->importShortClasses($this->importShortClasses); |
@@ -605,6 +613,14 @@ public function withCache(?string $cacheDirectory = null, ?string $cacheClass = |
605 | 613 | $this->containerCacheDirectory = $containerCacheDirectory; |
606 | 614 | return $this; |
607 | 615 | } |
| 616 | + /** |
| 617 | + * @param class-string<CacheMetaExtensionInterface> $cacheMetaExtensionClass |
| 618 | + */ |
| 619 | + public function withCacheMetaExtension(string $cacheMetaExtensionClass): self |
| 620 | + { |
| 621 | + $this->cacheMetaExtensions[] = $cacheMetaExtensionClass; |
| 622 | + return $this; |
| 623 | + } |
608 | 624 | /** |
609 | 625 | * @param class-string<ConfigurableRectorInterface> $rectorClass |
610 | 626 | * @param mixed[] $configuration |
|
0 commit comments