Skip to content

Array key type isn't reduced based on conditions, but value type is #4910

@dktapps

Description

@dktapps

Bug report

In the below example, an array is populated using the same keys and values. The values are correctly inferred to be limited to 2|3|4|5, but the keys are not, resulting in a spurious error.

Code snippet that reproduces the problem

https://phpstan.org/r/d2f07757-a48b-43ed-a27f-87cdd012922a

Expected output

No error should be reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions