|
22 | 22 | use PHPStan\Internal\ArrayHelper; |
23 | 23 | use PHPStan\Internal\ComposerHelper; |
24 | 24 | use PHPStan\PhpDoc\StubFilesProvider; |
25 | | -use PHPStan\Reflection\ReflectionProvider; |
26 | 25 | use PHPStan\ShouldNotHappenException; |
| 26 | +use ReflectionClass; |
| 27 | +use ReflectionException; |
27 | 28 | use Throwable; |
28 | 29 | use function array_diff; |
29 | 30 | use function array_fill_keys; |
@@ -82,7 +83,6 @@ public function __construct( |
82 | 83 | private ExportedNodeFetcher $exportedNodeFetcher, |
83 | 84 | #[AutowiredParameter(ref: '@fileFinderScan')] |
84 | 85 | private FileFinder $scanFileFinder, |
85 | | - private ReflectionProvider $reflectionProvider, |
86 | 86 | private StubFilesProvider $stubFilesProvider, |
87 | 87 | private FileHelper $fileHelper, |
88 | 88 | #[AutowiredParameter(ref: '%resultCachePath%')] |
@@ -936,13 +936,15 @@ private function getProjectExtensionFiles(?array $projectConfig, array $dependen |
936 | 936 |
|
937 | 937 | $classes = ProjectConfigHelper::getServiceClassNames($projectConfig); |
938 | 938 | foreach ($classes as $class) { |
939 | | - if (!$this->reflectionProvider->hasClass($class)) { |
| 939 | + try { |
| 940 | + // does not use static reflection to reduce file-parsing |
| 941 | + $classReflection = new ReflectionClass($class); /** @phpstan-ignore argument.type */ |
| 942 | + } catch (ReflectionException) { |
940 | 943 | continue; |
941 | 944 | } |
942 | 945 |
|
943 | | - $classReflection = $this->reflectionProvider->getClass($class); |
944 | 946 | $fileName = $classReflection->getFileName(); |
945 | | - if ($fileName === null) { |
| 947 | + if ($fileName === false) { |
946 | 948 | continue; |
947 | 949 | } |
948 | 950 |
|
|
0 commit comments