Skip to content

Result of DateTime::diff()->days becomes float|int if compared with anything #3127

@alexeyinkin

Description

@alexeyinkin

DateInterval::days is guaranteed to be int if it was created by DateTime::diff(). But if it is compared with anything, then phpstan thinks it becomes float|int.

To reproduce:
https://phpstan.org/r/3b785a03-c6e8-4c2c-8112-13b2d3369551

Correct behavior without comparison:
https://phpstan.org/r/ffa27f53-1a00-4022-8be1-227d7503759b

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions