File tree 3 files changed +30
-3
lines changed
3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ parameters:
24
24
- stubs/EntityManager.stub
25
25
- stubs/EntityManagerDecorator.stub
26
26
- stubs/EntityManagerInterface.stub
27
- - stubs/ServiceEntityRepository.stub
28
27
- stubs/MongoClassMetadataInfo.stub
29
28
30
29
- stubs/Persistence/ManagerRegistry.stub
Original file line number Diff line number Diff line change 3
3
namespace PHPStan \Stubs \Doctrine ;
4
4
5
5
use PHPStan \PhpDoc \StubFilesExtension ;
6
+ use function class_exists ;
6
7
use function dirname ;
7
8
8
9
class StubFilesExtensionLoader implements StubFilesExtension
@@ -20,16 +21,25 @@ public function __construct(
20
21
21
22
public function getFiles (): array
22
23
{
23
- $ path = dirname (dirname (dirname (__DIR__ ))) . '/stubs ' ;
24
+ $ stubsDir = dirname (dirname (dirname (__DIR__ ))) . '/stubs ' ;
25
+ $ path = $ stubsDir ;
24
26
25
27
if ($ this ->bleedingEdge === true ) {
26
28
$ path .= '/bleedingEdge ' ;
27
29
}
28
30
29
- return [
31
+ $ files = [
30
32
$ path . '/ORM/QueryBuilder.stub ' ,
31
33
$ path . '/EntityRepository.stub ' ,
32
34
];
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 ;
33
43
}
34
44
35
45
}
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