🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

array_key_exists does not narrow the same key definitively unset #9461

Description

@mvorisek

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/2e8de864-4363-4650-bf36-6141d67a3afb

https://phpstan.org/r/70eef2b2-0764-444d-85bd-daec2140a65a shows the problem is in array_key_exists narrowing

Expected output

The return type must be satisfied, ie. no phpstan error.

The 2nd dump must show:

-Dumped type: array<0|string, mixed>
+Dumped type: array<string, mixed>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions