Skip to content

return type of SimpleXMLElement::xpath could be null or false #13236

Open
phpstan/phpstan-src
#4096
@azjezz

Description

@azjezz

Bug report

It seems that phpstan has invalid stubs for SimpleXMLElement as the return type of xpath is assumed to be array instead of array|null|false.

ref: https://www.php.net/manual/en/simplexmlelement.xpath.php
ref: https://psalm.dev/r/a95dc1b740

Code snippet that reproduces the problem

https://phpstan.org/r/74ce4bd9-a23d-4c5a-a027-8fd97a41fa3f

Expected output

No issues

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