Skip to content

Undetected "Cannot unpack array with string keys" #5764

@Dgame

Description

@Dgame

Bug report

The following code snippet results in Cannot unpack array with string keys, but phpstan says there is no error:

function foo(int ...$is): array
{
    return [...$is];
}

foo(...['a' => 2]);

Code snippet that reproduces the problem

https://phpstan.org/r/f271ae5f-b3e9-4444-9d9b-1c617ded9e95

Expected output

Some error that string keys are not supported in unpacked arrays

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

Love it!

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