Skip to content

Use-by-reference combined with variable assignments causing array shape to get out of whack #6008

@Seldaek

Description

@Seldaek

Bug report

When an associative array with a shape definition gets used by reference by a lambda, and inside the lambda the array gets some unknown variable assigned it changes the array shape of another key. This makes no sense to me already but also just defining a lambda with an use-by-ref shouldn't do anything as long as you don't call it anyway?

Code snippet that reproduces the problem

https://phpstan.org/r/88467aa0-1dd4-421a-ba53-f0feb4dcd14e

Expected output

No error

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

Yes, found a nasty bug due to another typoed array key, so I'd rather get this one working too ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions