File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 66 "prefer-stable" : true ,
77 "require" : {
88 "php" : " ~7.0" ,
9- "phpstan/phpstan" : " ^0.6" ,
9+ "phpstan/phpstan" : " ^0.6.3 " ,
1010 "doctrine/common" : " ^2.7" ,
1111 "doctrine/orm" : " ^2.5"
1212 },
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ services:
33 class : PHPStan\Reflection\Doctrine\DoctrineSelectableClassReflectionExtension
44 tags :
55 - phpstan.broker.methodsClassReflectionExtension
6+ -
7+ class : PHPStan\Type\Doctrine\DoctrineSelectableDynamicReturnTypeExtension
8+ tags :
9+ - phpstan.broker.dynamicMethodReturnTypeExtension
610 -
711 class : PHPStan\Type\Doctrine\EntityManagerFindDynamicReturnTypeExtension
812 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