How to type hint a callable? #4520
-
I have the following snippet: https://phpstan.org/r/b8b0150a-6fad-4c1c-9d5e-37f2194a3c28 I'd expect to get an error here about the return type. The fact that it returns returns an int, while type hinted as a string, but there is no error. I can even do something like this, without getting any errors: https://phpstan.org/r/fb836c23-b650-426c-9efc-0c179c72f095 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, this is not yet supported, you'd need |
Beta Was this translation helpful? Give feedback.
Hi, this is not yet supported, you'd need
@param
for that. What you currently did is to inform PHPStan what happens when you call the callback: https://phpstan.org/r/21207869-f1af-4499-a6e7-fdccf6fec28a