1--TEST-- 2Dom\HTMLDocument::registerNodeClass 03 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8class Custom extends Dom\HTMLElement { 9 public int $test = 1; 10 11 public function reverseTagName(): string { 12 var_dump($this->test); 13 return strrev($this->tagName); 14 } 15} 16 17$dom = Dom\HTMLDocument::createFromString("<div>foo</div>", LIBXML_NOERROR); 18$dom->registerNodeClass("Dom\\HTMLElement", "Custom"); 19 20var_dump($dom->getElementsByTagName('div')[0]->reverseTagName()); 21 22?> 23--EXPECT-- 24int(1) 25string(3) "VID" 26