From 8803324d22c7f4834bc0a358da8141802f3907ac Mon Sep 17 00:00:00 2001 From: croensch <christoph.roensch@arcor.de> Date: Thu, 7 Mar 2024 17:33:29 +0100 Subject: [PATCH] IssueXML.php: skip DOCTYPE (fixes cobertura) skips '<!DOCTYPE coverage SYSTEM ...' (cobertura) and uses the following element instead --- phpstan_baseline.neon | 5 ----- src/PHPCodeBrowser/IssueXML.php | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpstan_baseline.neon b/phpstan_baseline.neon index 38cd3fa..f45121d 100644 --- a/phpstan_baseline.neon +++ b/phpstan_baseline.neon @@ -25,11 +25,6 @@ parameters: count: 1 path: src/PHPCodeBrowser/IssueXML.php - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/PHPCodeBrowser/IssueXML.php - - message: "#^Only booleans are allowed in a negated boolean, string given\\.$#" count: 1 diff --git a/src/PHPCodeBrowser/IssueXML.php b/src/PHPCodeBrowser/IssueXML.php index 0afd8b0..1911f1b 100644 --- a/src/PHPCodeBrowser/IssueXML.php +++ b/src/PHPCodeBrowser/IssueXML.php @@ -56,6 +56,7 @@ namespace PHPCodeBrowser; use DOMDocument; +use DOMDocumentType; use DOMNode; use DOMNodeList; use DOMXPath; @@ -155,6 +156,10 @@ public function addDirectory(string $directory): IssueXML public function addXMLFile(DOMDocument $domDocument): void { foreach ($domDocument->childNodes as $node) { + if ($node instanceof DOMDocumentType) { + continue; + } + $this->documentElement->appendChild($this->importNode($node, true)); } }