Skip to content

array without 0 key cannot be a list #9487

@mvorisek

Description

@mvorisek

Feature request

repro: https://phpstan.org/r/037a17ce-d709-4a19-8e4e-fc19915aa188

I would expect phpstan to emit an error even for level <= 6, as array<positive-int, string> is guaranteed to be not a subtype of list.

The check is easy - check if the type does allow 0 as key.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions