From 803eb8585f9540b3c50118817179cced6b58a4b3 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 22 Oct 2022 22:17:19 +0200 Subject: [PATCH] Immutable refactoring --- src/Hooks/TestCaseHandler.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Hooks/TestCaseHandler.php b/src/Hooks/TestCaseHandler.php index dd1e6b6..1f0f83c 100644 --- a/src/Hooks/TestCaseHandler.php +++ b/src/Hooks/TestCaseHandler.php @@ -164,8 +164,7 @@ class TestCaseHandler implements } foreach ($specials['dataProvider'] as $line => $provider) { - $provider_docblock_location = clone $method_storage->location; - $provider_docblock_location->setCommentLine($line); + $provider_docblock_location = $method_storage->location->setCommentLine($line); if (false !== strpos($provider, '::')) { [$class_name, $method_id] = explode('::', $provider); @@ -328,9 +327,8 @@ class TestCaseHandler implements $provider_return_type_string, $provider_docblock_location ): void { - $param_type = clone $param_type; if ($is_optional) { - $param_type->possibly_undefined = true; + $param_type = $param_type->setPossiblyUndefined(true); } if ($codebase->isTypeContainedByType($potential_argument_type, $param_type)) { // ok