Bug report
Callable signature types cannot be used as template bounds.
In particular, Closure(int): int, callable, and callable(int): int bounds are rejected when the template type is used for a natively typed Closure or callable parameter, even though a concrete closure can satisfy these bounds.
Code snippet that reproduces the problem
https://phpstan.org/r/142a3689-bc7a-4a5b-a612-1c0c3e199c20
Expected output
Callable types should be usable as template bounds, and the concrete type inferred for the template should be preserved.
In this example, static-Closure(int): int satisfies all four template bounds, so all four calls should infer:
static-Closure(int): int
Did PHPStan help you today? Did it make you happy in any way?
No response
Bug report
Callable signature types cannot be used as template bounds.
In particular,
Closure(int): int,callable, andcallable(int): intbounds are rejected when the template type is used for a natively typedClosureorcallableparameter, even though a concrete closure can satisfy these bounds.Code snippet that reproduces the problem
https://phpstan.org/r/142a3689-bc7a-4a5b-a612-1c0c3e199c20
Expected output
Callable types should be usable as template bounds, and the concrete type inferred for the template should be preserved.
In this example,
static-Closure(int): intsatisfies all four template bounds, so all four calls should infer:static-Closure(int): intDid PHPStan help you today? Did it make you happy in any way?
No response