From 7626876ab32801ed99d4a9f197f88e03ef903ed1 Mon Sep 17 00:00:00 2001 From: Jan Nedbal Date: Thu, 27 Aug 2026 17:04:24 +0200 Subject: [PATCH] Fix simplexml_import_dom() parameter type on PHP 8.4 PHP 8.4 widened the first parameter to `object`, so that the function accepts the classes of the new DOM API next to `DOMNode`: // PHP 8.3 function simplexml_import_dom(SimpleXMLElement|DOMNode $node, ?string $class_name = SimpleXMLElement::class): ?SimpleXMLElement {} // PHP 8.4 function simplexml_import_dom(object $node, ?string $class_name = SimpleXMLElement::class): ?SimpleXMLElement {} The map still declares `DOMNode` for every version. As a result, PHPStan reports a false positive when the argument is a `Dom\Node`: Parameter #1 $node of function simplexml_import_dom expects DOMNode, Dom\Node given. Versions below 8.4 keep the previous type. --- resources/functionMap_php84delta.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/functionMap_php84delta.php b/resources/functionMap_php84delta.php index d5552a0840e..73a35c5e474 100644 --- a/resources/functionMap_php84delta.php +++ b/resources/functionMap_php84delta.php @@ -20,8 +20,9 @@ 'http_clear_last_response_headers' => ['void'], 'mb_lcfirst' => ['string', 'string'=>'string', 'encoding='=>'string'], 'mb_ucfirst' => ['string', 'string'=>'string', 'encoding='=>'string'], + 'simplexml_import_dom' => ['SimpleXMLElement|null', 'node'=>'object', 'class_name='=>'string'], ], 'old' => [ - + 'simplexml_import_dom' => ['SimpleXMLElement|null', 'node'=>'DOMNode', 'class_name='=>'string'], ] ];