From 2c38013c7ff42756b787b1ecbb8f9fa7206a44a2 Mon Sep 17 00:00:00 2001 From: Saif Eddin Gmati <29315886+azjezz@users.noreply.github.com> Date: Thu, 10 Nov 2022 19:48:59 +0100 Subject: [PATCH] fix: don't close argument type. ref https://github.com/vimeo/psalm/pull/8691#discussion_r1019192376 --- .../Type/Optional/FunctionReturnTypeProvider.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/EventHandler/Type/Optional/FunctionReturnTypeProvider.php b/src/EventHandler/Type/Optional/FunctionReturnTypeProvider.php index 2c0fbb3..896f434 100644 --- a/src/EventHandler/Type/Optional/FunctionReturnTypeProvider.php +++ b/src/EventHandler/Type/Optional/FunctionReturnTypeProvider.php @@ -28,9 +28,6 @@ public static function getFunctionReturnType(FunctionReturnTypeProviderEvent $ev return null; } - $clone = clone $argument_type; - $clone->possibly_undefined = true; - - return $clone; + return $argument_type->setPossiblyUndefined(true); } }