Skip to content

array_map ignores union of callables #10442

@mad-briller

Description

@mad-briller

Bug report

array_map ignores a union of callables and assumes only the first of the union will be used, leading to an incorrectly inferred return type.

This line appears to be where the issue originates from, as the dynamic return type extension is asking for the parameter acceptors from here.

Code snippet that reproduces the problem

https://phpstan.org/r/216eb0ae-bd17-4f8d-badd-466f7d2aee6e

Expected output

Expectations specified in playground with assertType

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

As always!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions