File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 11
11
use PHPStan \Type \ErrorType ;
12
12
use PHPStan \Type \Generic \GenericObjectType ;
13
13
use PHPStan \Type \IntegerType ;
14
+ use PHPStan \Type \MixedType ;
14
15
use PHPStan \Type \ObjectType ;
15
16
use PHPStan \Type \Type ;
16
17
use SaschaEgerer \PhpstanTypo3 \Helpers \Typo3ClassNamingUtilityTrait ;
17
18
use TYPO3 \CMS \Extbase \Persistence \Generic \QueryResult ;
18
19
use TYPO3 \CMS \Extbase \Persistence \QueryInterface ;
20
+ use TYPO3 \CMS \Extbase \Persistence \Repository ;
19
21
20
22
class QueryInterfaceDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
21
23
{
@@ -51,12 +53,15 @@ public function getTypeFromMethodCall(
51
53
if ($ classReflection === null ) {
52
54
return new ErrorType ();
53
55
}
56
+ $ modelType = [new MixedType ()];
54
57
55
- $ modelName = $ this ->translateRepositoryNameToModelName (
56
- $ classReflection ->getName ()
57
- );
58
+ if ($ classReflection ->isSubclassOf (Repository::class)) {
59
+ $ modelName = $ this ->translateRepositoryNameToModelName (
60
+ $ classReflection ->getName ()
61
+ );
58
62
59
- $ modelType = [new ObjectType ($ modelName )];
63
+ $ modelType = [new ObjectType ($ modelName )];
64
+ }
60
65
}
61
66
62
67
if ($ argument !== null ) {
You can’t perform that action at this time.
0 commit comments