From 5e86ca53ca229907ce582dc94ff69c6776c6def9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C5=A0tv=C3=A1n?= Date: Wed, 24 Jul 2024 10:03:07 +0000 Subject: [PATCH] dont expensively clone flagsmith instance, just set the property --- src/Concerns/HasWith.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Concerns/HasWith.php b/src/Concerns/HasWith.php index 2c3004d..8c84b73 100644 --- a/src/Concerns/HasWith.php +++ b/src/Concerns/HasWith.php @@ -5,7 +5,7 @@ trait HasWith { /** - * Clones class with new property + * Set the new property * * @param string $property * @param mixed $value @@ -13,8 +13,7 @@ trait HasWith */ protected function with(string $property, $value): self { - $self = clone $this; - $self->{$property} = $value; - return $self; + $this->{$property} = $value; + return $this; } }