Skip to content

Offset int|string does not exist on array() #1664

@meridius

Description

@meridius

Summary of a problem or a feature request

False positive is returned because the problem cannot occur in described case.

Code snippet that reproduces the problem

https://phpstan.org/r/cb4cf70a-e2d7-4bff-bb4b-653ed807c4ac

Expected output

I think this is false positive since array_rand() will always return int if only integers are used as keys; string if strings are as keys; and int|string only if integers and strings are mixed as keys. However they are not in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions