Skip to content

array_key_first offset does not exits #8649

@Xirdion

Description

@Xirdion

Bug report

I have an array of arrays and looping over it.
I am then extracting the first array key with array_key_first.
After that I am checking the key.
In some cases I will do a continue inside the loop.
But if all is fine, I try to get the value of the array with the given key.
But here phpstan tells me that the offset does not exist.

Code snippet that reproduces the problem

https://phpstan.org/r/7bcc093c-65e8-4e01-aa35-7345c6cf7a0f

Expected output

I would expect, that all keys I am using to access the array are correct.

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

I really love PHPStan and have much fun optimizing my code. :)

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