File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ parameters:
2424 - stubs/EntityManager.stub
2525 - stubs/EntityManagerDecorator.stub
2626 - stubs/EntityManagerInterface.stub
27- - stubs/ServiceEntityRepository.stub
2827 - stubs/MongoClassMetadataInfo.stub
2928
3029 - stubs/Persistence/ManagerRegistry.stub
Original file line number Diff line number Diff line change 33namespace PHPStan \Stubs \Doctrine ;
44
55use PHPStan \PhpDoc \StubFilesExtension ;
6+ use function class_exists ;
67use function dirname ;
78
89class StubFilesExtensionLoader implements StubFilesExtension
@@ -20,16 +21,25 @@ public function __construct(
2021
2122 public function getFiles (): array
2223 {
23- $ path = dirname (dirname (dirname (__DIR__ ))) . '/stubs ' ;
24+ $ stubsDir = dirname (dirname (dirname (__DIR__ ))) . '/stubs ' ;
25+ $ path = $ stubsDir ;
2426
2527 if ($ this ->bleedingEdge === true ) {
2628 $ path .= '/bleedingEdge ' ;
2729 }
2830
29- return [
31+ $ files = [
3032 $ path . '/ORM/QueryBuilder.stub ' ,
3133 $ path . '/EntityRepository.stub ' ,
3234 ];
35+
36+ if (class_exists ('Doctrine\Bundle\DoctrineBundle\Repository\LazyServiceEntityRepository ' )) {
37+ $ files [] = $ stubsDir . '/LazyServiceEntityRepository.stub ' ;
38+ } else {
39+ $ files [] = $ stubsDir . '/ServiceEntityRepository.stub ' ;
40+ }
41+
42+ return $ files ;
3343 }
3444
3545}
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace Doctrine\Bundle\DoctrineBundle\Repository;
3+
4+ use Doctrine\ORM\EntityRepository;
5+
6+ /**
7+ * @template TEntityClass of object
8+ * @template-extends LazyServiceEntityRepository<TEntityClass>
9+ */
10+ class ServiceEntityRepository extends LazyServiceEntityRepository {
11+ }
12+
13+ /**
14+ * @template TEntityClass of object
15+ * @template-extends EntityRepository<TEntityClass>
16+ */
17+ class LazyServiceEntityRepository extends EntityRepository {
18+ }
You can’t perform that action at this time.
0 commit comments