Skip to content

Generics only resolving once #9167

@simon-tma

Description

@simon-tma

Bug report

The generic parameter is being used as the return type of the closure, rather than being resolved further

Code snippet that reproduces the problem

https://phpstan.org/r/888dd924-0572-4f7d-b143-7a6aea1a9924

Expected output

Shouldn't report any error. TRet should be resolved to int rather than T.

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

Added the non-negative-int type to a function parameter that was assuming as such and immediately picked up a couple of edge-case bugs :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions