From cca33ec9ef057b4e03928b68a69dea236a337562 Mon Sep 17 00:00:00 2001 From: romalytvynenko Date: Mon, 16 Sep 2024 15:13:46 +0300 Subject: [PATCH] fixed mutating types (#546) --- src/Infer/Services/ReferenceTypeResolver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Infer/Services/ReferenceTypeResolver.php b/src/Infer/Services/ReferenceTypeResolver.php index 34d489e2..d2622933 100644 --- a/src/Infer/Services/ReferenceTypeResolver.php +++ b/src/Infer/Services/ReferenceTypeResolver.php @@ -119,7 +119,7 @@ public function resolve(Scope $scope, Type $type): Type onInfiniteRecursion: fn () => new UnknownType('really bad self reference'), ); - return RecursionGuard::run( + return deep_copy(RecursionGuard::run( $resultingType,//->toString(), fn () => (new TypeWalker)->replace( $resultingType, @@ -128,7 +128,7 @@ public function resolve(Scope $scope, Type $type): Type : null, ), onInfiniteRecursion: fn () => new UnknownType('really bad self reference'), - ); + )); } private function checkDependencies(AbstractReferenceType $type)