Skip to content

PHPStan doesn't resolve template type when its the return type of a first class callable #12691

@axlon

Description

@axlon

Bug report

Type inference seems to break when calling methods that use a callable's return as a template type for a the returned value, if that callable is a first class callable.

Code snippet that reproduces the problem

https://phpstan.org/r/975298d0-951e-4c81-96d6-d19c9a83be4a

Expected output

I expected both syntaxes the have the same inferred type, I think PHPStan is missing a condition somewhere to take first class callables into account and as a result the template type is never resolved

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

No response

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