@@ -39,29 +39,21 @@ public function getTypeFromMethodCall(
39
39
$ varType = $ scope ->getType ($ methodCall ->var );
40
40
$ methodName = $ methodReflection ->getName ();
41
41
42
- if ($ methodName === 'count ' ) {
43
- if ($ varType instanceof EntityQueryType) {
44
- $ returnType = new EntityQueryCountType (
45
- $ varType ->getClassName (),
46
- $ varType ->getSubtractedType (),
47
- $ varType ->getClassReflection ()
48
- );
49
-
50
- if ($ varType ->hasAccessCheck ()) {
51
- return $ returnType ->withAccessCheck ();
52
- }
42
+ if (!$ varType instanceof ObjectType) {
43
+ return $ defaultReturnType ;
44
+ }
53
45
54
- return $ returnType ;
46
+ if ($ methodName === 'count ' ) {
47
+ $ returnType = new EntityQueryCountType (
48
+ $ varType ->getClassName (),
49
+ $ varType ->getSubtractedType (),
50
+ $ varType ->getClassReflection ()
51
+ );
52
+ if ($ varType instanceof EntityQueryType && $ varType ->hasAccessCheck ()) {
53
+ return $ returnType ->withAccessCheck ();
55
54
}
56
55
57
- if ($ varType instanceof ObjectType) {
58
- return new EntityQueryCountType (
59
- $ varType ->getClassName (),
60
- $ varType ->getSubtractedType (),
61
- $ varType ->getClassReflection ()
62
- );
63
- }
64
- return $ defaultReturnType ;
56
+ return $ returnType ;
65
57
}
66
58
67
59
if ($ methodName === 'execute ' ) {
0 commit comments