Skip to content

Array shape with multiple optional key error with key being set dynamically #4809

@edpittol

Description

@edpittol

Bug report

I'm getting Offset 'another'\|'some' does not exist on array(?'some' => string, ?'another' => string). When I try run in a function that receive the key as function argument and validate if the argument value is strict to some and another.

Code snippet that reproduces the problem

https://phpstan.org/r/dd639e0b-0c5d-45f1-a22e-7727f04cf471

Expected output

No errors!

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