Skip to content

Commit a5a457f

Browse files
committed
Fix return-type for XPath::xpQuery
1 parent 95a85b6 commit a5a457f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/XPath/XPath.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ public static function getXPath(DOMNode $node): DOMXPath
5252
* @param \DOMNode $node The XML node.
5353
* @param string $query The query.
5454
* @param \DOMXPath $xpCache The DOMXPath object
55-
* @return array<int<0, max>, \DOMNameSpaceNode|\DOMNode|null> Array with matching DOM nodes.
55+
* @return array<\DOMNode> Array with matching DOM nodes.
5656
*/
5757
public static function xpQuery(DOMNode $node, string $query, DOMXPath $xpCache): array
5858
{
5959
$ret = [];
6060

6161
$results = $xpCache->query($query, $node);
62+
Assert::notFalse($results, 'Malformed XPath query or invalid contextNode provided.');
63+
6264
for ($i = 0; $i < $results->length; $i++) {
6365
$ret[$i] = $results->item($i);
6466
}

0 commit comments

Comments
 (0)