Skip to content

Wrong assumption about array_merge result #14526

@ondrejmirtes

Description

@ondrejmirtes

Bug report

If the input can be an empty array, the output of array_merge(...$a) can also be an empty array.

But PHPStan assumes it won't be empty.

Code snippet that reproduces the problem

https://phpstan.org/r/f92011a8-c959-4559-9a01-520ba5089eb7

Expected output

The dumped type after array_merge(...$values) should include an empty array.

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