Skip to content

SimpleXmlElement is valid in intval #14136

@robotomarvin

Description

@robotomarvin

Bug report

Hi, I have found a small issue after upgrading to newest phpstan 2.1.39 (from 2.1.36), and got reported

Parameter #1 $value of function intval expects array|bool|float|int|resource|string|null, SimpleXMLElement given.

Even when official doc says

intval() should not be used on objects, as doing so will emit an E_WARNING level error and return 1.

it works without a warning and looks like a special case.

(https://3v4l.org/cOvks#v8.5.3)

Code snippet that reproduces the problem

https://phpstan.org/r/974d2e74-2e37-461b-814f-1a3d8d84b4a9

Expected output

No error reported

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