Callable prototypes#430
Callable prototypes#430dktapps wants to merge 10 commits intophpstan:masterfrom pmmp:callable-prototypes
Conversation
| TypeTraverser::map($type, static function (Type $type, callable $traverse) use (&$result): Type { | ||
| if ( | ||
| ($type instanceof CallableType && $type->isCommonCallable()) || | ||
| ($type instanceof ObjectType && $type->getClassName() === \Closure::class)) { |
There was a problem hiding this comment.
This is the only thing I'm not happy with. I think there should be a better, more generalized way to do this, but if there is one it's not apparent to me.
There was a problem hiding this comment.
This is probably fine... There's Type::isCallable() and Type::getCallableParametersAcceptors() but there's no way to extract whether it's general callable or already specified callable from that.
So as long as this place is synchronized with TypeNodeResolver::resolveCallableTypeNode(), we're fine.
|
I've already added a few commits locally, I'm taking over the PR, thanks. |
|
In master. Thank you. |
|
@dktapps Please submit a documentation change that explains this setting somewhere here: https://phpstan.org/config-reference#stricter-analysis Thanks. |
|
Awesome, thanks! Will attend to the docs as soon as I get home. |
This is a working implementation, although a bit rough around the edges.
A new toggle
checkMissingCallablePrototypeis added, disabled by default (as per @ondrejmirtes request).