Skip to content

Commit 4ba867b

Browse files
staabmsebastianbergmann
authored andcommitted
Node properties are immutable
1 parent 7bc4704 commit 4ba867b

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/Report/Xml/Node.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
*/
1919
abstract class Node
2020
{
21-
private DOMDocument $dom;
22-
private DOMElement $contextNode;
21+
private readonly DOMDocument $dom;
22+
private readonly DOMElement $contextNode;
2323

2424
public function __construct(DOMElement $context)
2525
{
26-
$this->setContextNode($context);
26+
$this->dom = $context->ownerDocument;
27+
$this->contextNode = $context;
2728
}
2829

2930
public function dom(): DOMDocument
@@ -76,12 +77,6 @@ public function addFile(string $name, string $href): File
7677
return new File($fileNode);
7778
}
7879

79-
protected function setContextNode(DOMElement $context): void
80-
{
81-
$this->dom = $context->ownerDocument;
82-
$this->contextNode = $context;
83-
}
84-
8580
protected function contextNode(): DOMElement
8681
{
8782
return $this->contextNode;

0 commit comments

Comments
 (0)