From 080b17248b865f92f9278d5a89a03538d6623c20 Mon Sep 17 00:00:00 2001 From: Dev Team - emroc GmbH <104580363+devteam-emroc@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:00:11 +0100 Subject: [PATCH 1/2] Adding 'id' to DOMNodes with type string. --- src/voku/helper/AbstractSimpleHtmlDom.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/voku/helper/AbstractSimpleHtmlDom.php b/src/voku/helper/AbstractSimpleHtmlDom.php index 852114a..2c254f5 100644 --- a/src/voku/helper/AbstractSimpleHtmlDom.php +++ b/src/voku/helper/AbstractSimpleHtmlDom.php @@ -23,6 +23,15 @@ abstract class AbstractSimpleHtmlDom 'innerhtmlkeep' => 'innerHtmlKeep', ]; + /** + * @var string[] + */ + protected static $stringDomNodes = [ + 'id', + 'prefix', + 'content' + ]; + /** * @var \DOMElement|\DOMNode|null */ @@ -167,7 +176,7 @@ public function __set($name, $value) default: if ($this->node && \property_exists($this->node, $nameOrig)) { // INFO: Cannot assign null to property DOMNode::* of type string - if ($nameOrig === 'prefix' || $nameOrig === 'textContent') { + if (in_array($nameOrig, self::$stringDomNodes)) { $value = (string)$value; } From 445c8a3999e0111cec2adbfc1938bb5a9a3424e8 Mon Sep 17 00:00:00 2001 From: Dev Team - emroc GmbH <104580363+devteam-emroc@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:03:09 +0100 Subject: [PATCH 2/2] removing whitespace --- src/voku/helper/AbstractSimpleHtmlDom.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/voku/helper/AbstractSimpleHtmlDom.php b/src/voku/helper/AbstractSimpleHtmlDom.php index 2c254f5..fdc68a4 100644 --- a/src/voku/helper/AbstractSimpleHtmlDom.php +++ b/src/voku/helper/AbstractSimpleHtmlDom.php @@ -23,8 +23,8 @@ abstract class AbstractSimpleHtmlDom 'innerhtmlkeep' => 'innerHtmlKeep', ]; - /** - * @var string[] + /** + * @var string[] */ protected static $stringDomNodes = [ 'id',