Skip to content
This repository was archived by the owner on Oct 12, 2024. It is now read-only.

Commit fd28f3c

Browse files
authored
Merge pull request #4 from Crell/php81
Avoid PHP 8.1 deprecation notices.
2 parents d26e615 + d5d4702 commit fd28f3c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/Document.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ class Document extends \DOMDocument implements XPathAware
3131
*/
3232
public function __construct($version = '1.0', $encoding = null)
3333
{
34-
parent::__construct($version, $encoding);
34+
if ($encoding) {
35+
parent::__construct($version, $encoding);
36+
} else {
37+
parent::__construct($version);
38+
}
3539
$this->registerNodeClass('DOMElement', 'PhpBench\Dom\Element');
3640
}
3741

lib/XPath.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class XPath extends \DOMXPath
2323
/**
2424
* {@inheritdoc}
2525
*/
26+
#[\ReturnTypeWillChange]
2627
public function evaluate($expression, $contextnode = null, $registerNodeNS = true)
2728
{
2829
$result = $this->execute('evaluate', 'expression', $expression, $contextnode, $registerNodeNS);
@@ -33,6 +34,7 @@ public function evaluate($expression, $contextnode = null, $registerNodeNS = tru
3334
/**
3435
* @return DOMNodeList<DOMNode>
3536
*/
37+
#[\ReturnTypeWillChange]
3638
public function query($expression, $contextnode = null, $registerNodeNS = true)
3739
{
3840
return $this->execute('query', 'query', $expression, $contextnode, $registerNodeNS);
@@ -64,6 +66,7 @@ public function queryOne(string $expr, DOMNode $contextEl = null, bool $register
6466
*
6567
* @return mixed
6668
*/
69+
#[\ReturnTypeWillChange]
6770
private function execute(string $method, string $context, string $query, DOMNode $contextEl = null, bool $registerNodeNs = false)
6871
{
6972
libxml_use_internal_errors(true);

0 commit comments

Comments
 (0)