Skip to content

Extending an array is treated as if you are replacing it. #4708

@yphoenix

Description

@yphoenix

Bug report

When extending an array with: $arr['index'] = $value; and then using array_key_exists() to check for other indexes is flagged as false as PHPStan only thinks the new 'index' exists.

Code snippet that reproduces the problem

https://phpstan.org/r/957f0c1a-0167-411e-9bdb-b548a19dd8b6

Expected output

There shouldn't be any error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions