It seems like $doc can also be of type null; however, parameter $document of DOMXPath::__construct() does only seem to accept DOMDocument, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
40
$xpCache = new DOMXPath(/** @scrutinizer ignore-type */ $doc);
Loading history...
41
}
42
43
return $xpCache;
44
}
45
46
/**
47
* Do an XPath query on an XML node.
48
*
49
* @param \DOMNode $node The XML node.
50
* @param string $query The query.
51
* @param \DOMXPath|null $xpCache The DOMXPath object or NULL to create one
52
* @return \DOMNode[] Array with matching DOM nodes.
53
*/
54
public static function xpQuery(DOMNode $node, string $query, DOMXPath $xpCache): array