Skip to content

Commit 8485a80

Browse files
DanielEScherzerkocsismate
authored andcommitted
gen_stub: stop cloning Type objects
They are immutable
1 parent cecbcd9 commit 8485a80

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

build/gen_stub.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,8 @@ public function equals(SimpleType $other): bool {
531531
}
532532
}
533533

534+
// Instances of Type are immutable and do not need to be cloned
535+
// when held by an object that is cloned
534536
class Type {
535537
/** @var SimpleType[] */
536538
public /* readonly */ array $types;
@@ -3146,13 +3148,6 @@ protected function addModifiersToFieldSynopsis(DOMDocument $doc, DOMElement $fie
31463148
$fieldsynopsisElement->appendChild($doc->createElement("modifier", "readonly"));
31473149
}
31483150
}
3149-
3150-
public function __clone()
3151-
{
3152-
if ($this->type) {
3153-
$this->type = clone $this->type;
3154-
}
3155-
}
31563151
}
31573152

31583153
class EnumCaseInfo {

0 commit comments

Comments
 (0)