From 2649769a2de52f79cc1bafe975f7bfc14926c5ca Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 21 Nov 2025 07:58:54 +0100 Subject: [PATCH 1/2] Refactor: extract targetFilePath() method --- src/Report/Xml/Facade.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Report/Xml/Facade.php b/src/Report/Xml/Facade.php index 857423922..c3767088e 100644 --- a/src/Report/Xml/Facade.php +++ b/src/Report/Xml/Facade.php @@ -277,15 +277,20 @@ private function targetDirectory(): string return $this->target; } - /** - * @throws XmlException - */ - private function saveDocument(DOMDocument $document, string $name): void + private function targetFilePath(string $name): string { $filename = sprintf('%s/%s.xml', $this->targetDirectory(), $name); $this->initTargetDirectory(dirname($filename)); - Filesystem::write($filename, Xml::asString($document)); + return $filename; + } + + /** + * @throws XmlException + */ + private function saveDocument(DOMDocument $document, string $name): void + { + Filesystem::write($this->targetFilePath($name), Xml::asString($document)); } } From c1a9f74abe86a1a45f92264bf4604916045b30f9 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 21 Nov 2025 08:17:07 +0100 Subject: [PATCH 2/2] Use explicit Xml-namespace --- src/Report/Xml/Source.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Report/Xml/Source.php b/src/Report/Xml/Source.php index 448fe72d6..698a71b6d 100644 --- a/src/Report/Xml/Source.php +++ b/src/Report/Xml/Source.php @@ -31,7 +31,7 @@ public function setSourceCode(string $source): void $context = $this->context; $tokens = (new Tokenizer)->parse($source); - $srcDom = (new XMLSerializer(new NamespaceUri($context->namespaceURI)))->toDom($tokens); + $srcDom = (new XMLSerializer(new NamespaceUri(Facade::XML_NAMESPACE)))->toDom($tokens); $context->parentNode->replaceChild( $context->ownerDocument->importNode($srcDom->documentElement, true),