Skip to content

Offset access type where array has only one key fails with bound type string not supported #7381

@Seldaek

Description

@Seldaek

Bug report

Code snippet that reproduces the problem

It appears if the type T has only one key, T[K] fails because K is just a string and perhaps it expects always a union type of strings/keys?

https://phpstan.org/r/f4197fdb-eaef-485c-a5be-d026adf5e6c2

Expected output

No error

cc @rvanvelzen

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions