Skip to content
This repository was archived by the owner on Oct 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class Document extends \DOMDocument implements XPathAware
*/
public function __construct($version = '1.0', $encoding = null)
{
parent::__construct($version, $encoding);
if ($encoding) {
parent::__construct($version, $encoding);
} else {
parent::__construct($version);
}
$this->registerNodeClass('DOMElement', 'PhpBench\Dom\Element');
}

Expand Down
3 changes: 3 additions & 0 deletions lib/XPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class XPath extends \DOMXPath
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function evaluate($expression, $contextnode = null, $registerNodeNS = true)
{
$result = $this->execute('evaluate', 'expression', $expression, $contextnode, $registerNodeNS);
Expand All @@ -33,6 +34,7 @@ public function evaluate($expression, $contextnode = null, $registerNodeNS = tru
/**
* @return DOMNodeList<DOMNode>
*/
#[\ReturnTypeWillChange]
public function query($expression, $contextnode = null, $registerNodeNS = true)
{
return $this->execute('query', 'query', $expression, $contextnode, $registerNodeNS);
Expand Down Expand Up @@ -64,6 +66,7 @@ public function queryOne(string $expr, DOMNode $contextEl = null, bool $register
*
* @return mixed
*/
#[\ReturnTypeWillChange]
private function execute(string $method, string $context, string $query, DOMNode $contextEl = null, bool $registerNodeNs = false)
{
libxml_use_internal_errors(true);
Expand Down