Skip to content

Incorrect return type for DOMXPath::query() #13595

@stefanfisk

Description

@stefanfisk

Bug report

The return type for DOMXPath::query() is stubbed as DOMNodeList<DOMNode>|false at https://github.com/phpstan/phpstan-src/blob/afe24f012552aec51ea22bbadfa38aeb9392460e/stubs/dom.stub#L89. But the actual return type is DOMNodeList<DOMNode|DOMNameSpaceNode>|false.

The PHPStorm stubs have the correct type
https://github.com/JetBrains/phpstorm-stubs/blob/d1ee5e570343bd4276a3d5959e6e1c2530b006d0/dom/dom_c.php#L2499.

Code snippet that reproduces the problem

https://phpstan.org/r/9c5144b1-f9b2-48e5-a108-cd4151adc47d

Expected output

No errors.

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions