Skip to content

Commit 97289f1

Browse files
stefanfiskondrejmirtes
authored andcommitted
Fix XDOMPath::query() return type
Resolves phpstan/phpstan#13595
1 parent d667db8 commit 97289f1

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
@@ -86,7 +86,7 @@ class DOMElement extends DOMNode
8686
}
8787

8888
/**
89-
* @template-covariant TNode as DOMNode
89+
* @template-covariant TNode as DOMNameSpaceNode|DOMNode
9090
* @implements IteratorAggregate<int, TNode>
9191
*/
9292
class DOMNodeList implements IteratorAggregate, Countable
@@ -100,19 +100,6 @@ class DOMNodeList implements IteratorAggregate, Countable
100100

101101
}
102102

103-
class DOMXPath
104-
{
105-
106-
/**
107-
* @param string $expression
108-
* @param DOMNode|null $contextNode
109-
* @param boolean $registerNodeNS
110-
* @return DOMNodeList<DOMNode>|false
111-
*/
112-
public function query($expression, $contextNode, $registerNodeNS) {}
113-
114-
}
115-
116103
class DOMAttr extends DOMNode
117104
{
118105

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)