Skip to content

Phpstan loses type info after $array1 + $array2 #11912

@rudiedirkx

Description

@rudiedirkx

Bug report

I feel like Phpstan should know this. It adds 2 known arrays, with a very concrete key, and then forgets what's in the array. Compared to some of the array shapes that Phpstan knows and tracks, this one is simple.

Code snippet that reproduces the problem

https://phpstan.org/r/bc6269f4-2597-4d54-9906-f2a048afd338

Expected output

The dumped type should be list<string>, or at least array, but not mixed.

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