Skip to content

A negative zero float value has a different string representation than positive zero but phpstan is not aware of it #12225

@stof

Description

@stof

Bug report

In PHP, the positive and negative zero floats are considered to be equal even with ===. However, they have different string representations, so phpstan should not consider that the condition is always false.

Code snippet that reproduces the problem

https://phpstan.org/r/32d7bbe9-03ec-49ee-9a97-9e0115f81d28

Expected output

no error reported.

See https://3v4l.org/66kso for the runtime behavior of that code.

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions