|
7 | 7 | use PhpParser\NodeVisitor; |
8 | 8 | use Rector\Bridge\SetProviderCollector; |
9 | 9 | use Rector\Bridge\SetRectorsResolver; |
| 10 | +use Rector\Caching\Contract\CacheMetaExtensionInterface; |
10 | 11 | use Rector\Caching\Contract\ValueObject\Storage\CacheStorageInterface; |
11 | 12 | use Rector\Composer\InstalledPackageResolver; |
12 | 13 | use Rector\Config\Level\CodeQualityLevel; |
@@ -91,6 +92,11 @@ final class RectorConfigBuilder |
91 | 92 |
|
92 | 93 | private ?string $containerCacheDirectory = null; |
93 | 94 |
|
| 95 | + /** |
| 96 | + * @var array<class-string<CacheMetaExtensionInterface>> |
| 97 | + */ |
| 98 | + private array $cacheMetaExtensions = []; |
| 99 | + |
94 | 100 | private ?bool $parallel = null; |
95 | 101 |
|
96 | 102 | private int $parallelTimeoutSeconds = 120; |
@@ -316,6 +322,10 @@ public function __invoke(RectorConfig $rectorConfig): void |
316 | 322 | $rectorConfig->containerCacheDirectory($this->containerCacheDirectory); |
317 | 323 | } |
318 | 324 |
|
| 325 | + foreach ($this->cacheMetaExtensions as $cacheMetaExtensionClass) { |
| 326 | + $rectorConfig->cacheMetaExtension($cacheMetaExtensionClass); |
| 327 | + } |
| 328 | + |
319 | 329 | if ($this->importNames || $this->importDocBlockNames) { |
320 | 330 | $rectorConfig->importNames($this->importNames, $this->importDocBlockNames); |
321 | 331 | $rectorConfig->importShortClasses($this->importShortClasses); |
@@ -880,6 +890,16 @@ public function withCache( |
880 | 890 | return $this; |
881 | 891 | } |
882 | 892 |
|
| 893 | + /** |
| 894 | + * @param class-string<CacheMetaExtensionInterface> $cacheMetaExtensionClass |
| 895 | + */ |
| 896 | + public function withCacheMetaExtension(string $cacheMetaExtensionClass): self |
| 897 | + { |
| 898 | + $this->cacheMetaExtensions[] = $cacheMetaExtensionClass; |
| 899 | + |
| 900 | + return $this; |
| 901 | + } |
| 902 | + |
883 | 903 | /** |
884 | 904 | * @param class-string<ConfigurableRectorInterface> $rectorClass |
885 | 905 | * @param mixed[] $configuration |
|
0 commit comments