diff --git a/src/Type/ObjectProphecy/WillExtendOrImplementDynamicReturnTypeExtension.php b/src/Type/ObjectProphecy/WillExtendOrImplementDynamicReturnTypeExtension.php index ea02908..ebfbed9 100644 --- a/src/Type/ObjectProphecy/WillExtendOrImplementDynamicReturnTypeExtension.php +++ b/src/Type/ObjectProphecy/WillExtendOrImplementDynamicReturnTypeExtension.php @@ -55,10 +55,11 @@ public function getTypeFromMethodCall( $returnType = $parametersAcceptor->getReturnType(); - if ( - !$calledOnType instanceof Type\Generic\GenericObjectType - || Prophecy\ObjectProphecy::class !== $calledOnType->getClassName() - ) { + if (!$calledOnType instanceof Type\Generic\GenericObjectType) { + return $returnType; + } + + if (Prophecy\ObjectProphecy::class !== $calledOnType->getClassName()) { return $returnType; }