Skip to content

Commit ed1a207

Browse files
committed
LazyServiceEntityRepository is autoloadable only if LazyGhostTrait exists
1 parent 31f74fe commit ed1a207

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Stubs/Doctrine/StubFilesExtensionLoader.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPStan\PhpDoc\StubFilesExtension;
66
use function class_exists;
77
use function dirname;
8+
use function trait_exists;
89

910
class StubFilesExtensionLoader implements StubFilesExtension
1011
{
@@ -33,7 +34,10 @@ public function getFiles(): array
3334
$path . '/EntityRepository.stub',
3435
];
3536

36-
if (class_exists('Doctrine\Bundle\DoctrineBundle\Repository\LazyServiceEntityRepository')) {
37+
if (
38+
trait_exists('Symfony\Component\VarExporter\LazyGhostTrait')
39+
&& class_exists('Doctrine\Bundle\DoctrineBundle\Repository\LazyServiceEntityRepository')
40+
) {
3741
$files[] = $stubsDir . '/LazyServiceEntityRepository.stub';
3842
} else {
3943
$files[] = $stubsDir . '/ServiceEntityRepository.stub';

0 commit comments

Comments
 (0)