Misc fixes

This commit is contained in:
2024-10-07 00:30:09 +02:00
parent 46bf135446
commit 0e1354bd47
6 changed files with 33 additions and 32 deletions

View File

@@ -21,10 +21,9 @@ class ArrayNode extends Node implements CollapsibleNode
$this->items = array_values($this->items);
}
public function __clone()
public function __clone(): void
{
$items = array_map(fn($v) => clone $v, $this->items);
return new ArrayNode($items);
$this->items = array_map(fn($v) => clone $v, $this->items);
}
public function jsonSerialize(): mixed

View File

@@ -37,13 +37,12 @@ class ObjectNode extends Node implements CollapsibleNode
unset($this->properties[$key]);
}
public function __clone()
public function __clone(): void
{
$properties = array_combine(
$this->properties = array_combine(
array_keys($this->properties),
array_map(fn($v) => clone $v, $this->properties)
);
return new ObjectNode($properties);
}
public function jsonSerialize(): mixed