Skip to content

Commit 53e0344

Browse files
committed
Fix XDOMPath::query() return type
Resolves phpstan/phpstan#13595
1 parent 1cb8fc2 commit 53e0344

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

stubs/dom.stub

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class DOMElement extends DOMNode
6565
}
6666

6767
/**
68-
* @template-covariant TNode as DOMNode
68+
* @template-covariant TNode as DOMNameSpaceNode|DOMNode
6969
* @implements IteratorAggregate<int, TNode>
7070
*/
7171
class DOMNodeList implements IteratorAggregate, Countable
@@ -79,19 +79,6 @@ class DOMNodeList implements IteratorAggregate, Countable
7979

8080
}
8181

82-
class DOMXPath
83-
{
84-
85-
/**
86-
* @param string $expression
87-
* @param DOMNode|null $contextNode
88-
* @param boolean $registerNodeNS
89-
* @return DOMNodeList<DOMNode>|false
90-
*/
91-
public function query($expression, $contextNode, $registerNodeNS) {}
92-
93-
}
94-
9582
class DOMAttr extends DOMNode
9683
{
9784

tests/PHPStan/Analyser/nsrt/bug-6748.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public function iterateNodes ($list): void
1717
/** @param \DOMXPath $path */
1818
public function xPathQuery ($path)
1919
{
20-
assertType('DOMNodeList<DOMNode>|false', $path->query(''));
20+
assertType('DOMNodeList<DOMNameSpaceNode|DOMNode>|false', $path->query(''));
2121
}
2222
}

0 commit comments

Comments
 (0)