Skip to content

Variadic arrow function argument triggers "Cannot access offset 0 on mixed" and related errors #10671

@lkrms

Description

@lkrms

Bug report

Variadic arguments in arrow functions appear not to be treated as arrays, whereas in the equivalent anonymous function, the same code is handled correctly.

This only seems to occur when the relevant closure is passed to a receiving function/method annotated with @param Closure(mixed...) or similar.

Code snippet that reproduces the problem

https://phpstan.org/r/9f113284-063f-4bfa-b3cc-efa1fb02ba1a

Expected output

Arrow functions should be handled the same as other functions in this respect.

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