Skip to content

Error when using offset type access with conditional returns #7310

@aymanrady

Description

@aymanrady

Bug report

Offset type access M[K] in a conditional return results in an error.

p.s. specifying K of key-of<M> instead of K of string returns a union of all values in M

Code snippet that reproduces the problem

https://phpstan.org/r/e6243b1d-b497-4d28-9a4e-be12f69f34d9

Expected output

Line 33: Dumped Type: 2

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