Skip to content

"Offset (int|string) might not exist on array" after array_keys($arr) #12926

@staabm

Description

@staabm

Bug report

foreach iteration over array_keys($arr) should make phpstan aware of the offset

inspired on phpunit code

Code snippet that reproduces the problem

https://phpstan.org/r/6e491e13-b991-4e49-88d1-2e8e03c4b8ba

Expected output

no error on line 8

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions