From 1c425b71c6d9df6d5058c985d2128a9e2d3c0c09 Mon Sep 17 00:00:00 2001 From: Saif Eddin Gmati <29315886+azjezz@users.noreply.github.com> Date: Thu, 10 Nov 2022 19:50:16 +0100 Subject: [PATCH] fix: don't close argument type. (#7) 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 @@ final class FunctionReturnTypeProvider implements FunctionReturnTypeProviderInte return null; } - $clone = clone $argument_type; - $clone->possibly_undefined = true; - - return $clone; + return $argument_type->setPossiblyUndefined(true); } }