File tree 3 files changed +37
-1
lines changed
3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 6
6
"prefer-stable" : true ,
7
7
"require" : {
8
8
"php" : " ~7.0" ,
9
- "phpstan/phpstan" : " ^0.6" ,
9
+ "phpstan/phpstan" : " ^0.6.3 " ,
10
10
"doctrine/common" : " ^2.7" ,
11
11
"doctrine/orm" : " ^2.5"
12
12
},
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ services:
3
3
class : PHPStan\Reflection\Doctrine\DoctrineSelectableClassReflectionExtension
4
4
tags :
5
5
- phpstan.broker.methodsClassReflectionExtension
6
+ -
7
+ class : PHPStan\Type\Doctrine\DoctrineSelectableDynamicReturnTypeExtension
8
+ tags :
9
+ - phpstan.broker.dynamicMethodReturnTypeExtension
6
10
-
7
11
class : PHPStan\Type\Doctrine\EntityManagerFindDynamicReturnTypeExtension
8
12
tags :
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace PHPStan \Type \Doctrine ;
4
+
5
+ use PhpParser \Node \Expr \MethodCall ;
6
+ use PHPStan \Analyser \Scope ;
7
+ use PHPStan \Reflection \MethodReflection ;
8
+ use PHPStan \Type \Type ;
9
+
10
+ class DoctrineSelectableDynamicReturnTypeExtension implements \PHPStan \Type \DynamicMethodReturnTypeExtension
11
+ {
12
+
13
+ public static function getClass (): string
14
+ {
15
+ return \Doctrine \Common \Collections \Collection::class;
16
+ }
17
+
18
+ public function isMethodSupported (MethodReflection $ methodReflection ): bool
19
+ {
20
+ return $ methodReflection ->getName () === 'matching ' ;
21
+ }
22
+
23
+ public function getTypeFromMethodCall (
24
+ MethodReflection $ methodReflection ,
25
+ MethodCall $ methodCall ,
26
+ Scope $ scope
27
+ ): Type
28
+ {
29
+ return $ scope ->getType ($ methodCall ->var );
30
+ }
31
+
32
+ }
You can’t perform that action at this time.
0 commit comments