diff --git a/src/Prophecy/Prophecy/MethodProphecy.php b/src/Prophecy/Prophecy/MethodProphecy.php index d314287f..a3898ab7 100644 --- a/src/Prophecy/Prophecy/MethodProphecy.php +++ b/src/Prophecy/Prophecy/MethodProphecy.php @@ -174,6 +174,10 @@ static function (string $type1, string $type2) { $prophet = new Prophet(); return $prophet->prophesize()->reveal(); + case 'self': + case 'static': + return $object->reveal(); + default: if (!class_exists($defaultType) && !interface_exists($defaultType)) { throw new MethodProphecyException(sprintf('Cannot create a return value for the method as the type "%s" is not supported. Configure an explicit return value instead.', $defaultType), $method);