Skip to content

Commit b473c38

Browse files
authored
Merge pull request #106 from devteam-emroc/php-83
Adding 'id' to DOMNodes with type string.
2 parents e2ced08 + 445c8a3 commit b473c38

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/voku/helper/AbstractSimpleHtmlDom.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ abstract class AbstractSimpleHtmlDom
2323
'innerhtmlkeep' => 'innerHtmlKeep',
2424
];
2525

26+
/**
27+
* @var string[]
28+
*/
29+
protected static $stringDomNodes = [
30+
'id',
31+
'prefix',
32+
'content'
33+
];
34+
2635
/**
2736
* @var \DOMElement|\DOMNode|null
2837
*/
@@ -167,7 +176,7 @@ public function __set($name, $value)
167176
default:
168177
if ($this->node && \property_exists($this->node, $nameOrig)) {
169178
// INFO: Cannot assign null to property DOMNode::* of type string
170-
if ($nameOrig === 'prefix' || $nameOrig === 'textContent') {
179+
if (in_array($nameOrig, self::$stringDomNodes)) {
171180
$value = (string)$value;
172181
}
173182

0 commit comments

Comments
 (0)