diff --git a/src/MethodReflection.php b/src/MethodReflection.php index 0a8d7e2..3ad4551 100644 --- a/src/MethodReflection.php +++ b/src/MethodReflection.php @@ -370,7 +370,7 @@ protected function withResolvedTypes(TypeVisitor $typeResolver): static static fn (ParameterReflection $parameter): ParameterReflection => $parameter->withResolvedTypes($typeResolver), $this->parameters, ); - $method->returnType->withResolvedTypes($typeResolver); + $method->returnType = $method->returnType->withResolvedTypes($typeResolver); return $method; } @@ -385,7 +385,7 @@ protected function toChildOf(FriendlyReflection $parent): static : $parameter, $this->parameters, ); - $method->returnType->toChildOf($parent->returnType); + $method->returnType = $method->returnType->toChildOf($parent->returnType); return $method; }