Skip to content

Comparison operation ">" between (int<min, X>|int<Y, max>|string) and Z is always true. #5295

@neanton

Description

@neanton

Bug report

The following snippet produces this error:

Comparison operation ">" between (int<min, 4>|int<11, max>|string) and 10 is always true.

Seems like the problem is caused by mixed array key. Type hinting array returned from getValue function to <int, int> suppresses the warning.

Code snippet that reproduces the problem

https://phpstan.org/r/e9007c26-e626-49e5-aa97-469e860ea8ea

Expected output

No error should be thrown

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions