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
37
$xpCache = new DOMXPath(/** @scrutinizer ignore-type */ $doc);
Loading history...
38
}
39
40
return $xpCache;
41
}
42
43
/**
44
* Do an XPath query on an XML node.
45
*
46
* @param \DOMNode $node The XML node.
47
* @param string $query The query.
48
* @param \DOMXPath $xpCache The DOMXPath object
49
* @return array<int<0, max>, \DOMNameSpaceNode|\DOMNode|null> Array with matching DOM nodes.