document of class DOMXPath constructor expects DOMDocument, DOMDocument|null given. in HasXPath:106
Author: pscheitCreated Jul 26, 2025Updated Jul 26, 2025
if ($node instanceof \DOMDocument) {
$xpathDocument = new \DOMXPath($node);
return $xpathDocument->evaluate($this->_xpath);
} else {
$xpathDocument = new \DOMXPath($node->ownerDocument);
return $xpathDocument->evaluate($this->_xpath, $node);
}This error is detected by phpstan and was written to the baseline in #88
------ ------------------------------------------------------------------------------------------------------------------------------------------
Line hamcrest/Hamcrest/Xml/HasXPath.php
------ ------------------------------------------------------------------------------------------------------------------------------------------
106 Parameter #1 $document of class DOMXPath constructor expects DOMDocument, DOMDocument|null given.
argument.type
✏️ hamcrest/Hamcrest/Xml/HasXPath.php
120 Method Hamcrest\Xml\HasXPath::matchesContent() has parameter $nodes with generic class DOMNodeList but does not specify its types: TNode
missingType.generics
✏️ hamcrest/Hamcrest/Xml/HasXPath.php
------ ------------------------------------------------------------------------------------------------------------------------------------------Source: hamcrest/hamcrest-php