From 8485a804ababe4bec3572b0d0384a6187025ffe6 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Fri, 21 Feb 2025 17:36:39 -0800 Subject: [PATCH] gen_stub: stop cloning `Type` objects They are immutable --- build/gen_stub.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/build/gen_stub.php b/build/gen_stub.php index 5349adb1bf6..5143715179c 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -531,6 +531,8 @@ class SimpleType { } } +// Instances of Type are immutable and do not need to be cloned +// when held by an object that is cloned class Type { /** @var SimpleType[] */ public /* readonly */ array $types; @@ -3146,13 +3148,6 @@ class PropertyInfo extends VariableLike $fieldsynopsisElement->appendChild($doc->createElement("modifier", "readonly")); } } - - public function __clone() - { - if ($this->type) { - $this->type = clone $this->type; - } - } } class EnumCaseInfo {