Skip to content

array union operator incorrectly determines non-empty output #13561

@bitwise-operators

Description

@bitwise-operators

Bug report

Under certain circumstances (see example), the array union operator ('+'), will always assume its output to be non-empty, even if this is not necessarily the case.

array_merge does not have this problem, but since its behaviour is different, it's not a drop-in replacement

Code snippet that reproduces the problem

https://phpstan.org/r/016cc695-a104-4dac-8ad5-10bbc1c6d01d

Expected output

array<string, string>

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