Skip to content

SimpleXmlElement weirdness #2784

@orklah

Description

@orklah

Bug report

PHPStan thinks every direct call to an attribute on a SimpleXmlElement will return a SimpleXmlElement. This is not always true:
https://phpstan.org/r/f9336943-20db-4b3e-a9ba-671b6f58bd78
https://3v4l.org/kWSfE

While the first attribute does indeed return a SimpleXmlElement(even when the xml doesn't contain this element), this is not true for the second one.

PHPStan should not complain about always true checks in this context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions