Skip to content

Commit 79e3c8b

Browse files
committed
use factory file
1 parent 2bdac1b commit 79e3c8b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator;
99
use PHPStan\Reflection\BetterReflection\SourceLocator\FileNodesFetcher;
1010
use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedDirectorySourceLocatorFactory;
11-
use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedSingleFileSourceLocator;
1211
use Rector\Contract\DependencyInjection\ResettableInterface;
1312
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
1413

@@ -31,7 +30,8 @@ final class DynamicSourceLocatorProvider implements ResettableInterface
3130

3231
public function __construct(
3332
private readonly FileNodesFetcher $fileNodesFetcher,
34-
private readonly OptimizedDirectorySourceLocatorFactory $optimizedDirectorySourceLocatorFactory
33+
private readonly OptimizedDirectorySourceLocatorFactory $optimizedDirectorySourceLocatorFactory,
34+
private readonly \PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedSingleFileSourceLocatorRepository $optimizedSingleFileSourceLocatorRepository
3535
) {
3636
}
3737

@@ -68,7 +68,7 @@ public function provide(): SourceLocator
6868
$sourceLocators = [];
6969

7070
foreach ($this->filePaths as $file) {
71-
$sourceLocators[] = new OptimizedSingleFileSourceLocator($this->fileNodesFetcher, $file);
71+
$sourceLocators[] = $this->optimizedSingleFileSourceLocatorRepository->getOrCreate($file);
7272
}
7373

7474
foreach ($this->directories as $directory) {

0 commit comments

Comments
 (0)