Skip to content

callable type definition is not properly matched when using yield in a short arrow function #7031

@gnutix

Description

@gnutix

Bug report

Hello there,

I've already noticed in the past that PHPStan tends to report inspections when checking against a callable type depending on how the closure is written at call-site. I've had the issue again today and managed to reproduce it in the playground.

Code snippet that reproduces the problem

https://phpstan.org/r/7dc2492d-309e-4249-95f7-5250786a4e2c

Expected output

No inspection. The 4 different syntaxes (short+return, short+yield, full+return, full+yield) should all produce the same results.

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

As always, it helps with my confidence when doing refactorings. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions