Open KapitanOczywisty opened 5 years ago
This is somewhat related to #439 . Do any other IDE's or static analysis libs support function style doc block on closures?
I'd rather see something like this:
/** @var \Closure<int, string, bool, string> $func description */
$func = function ($a, $b, $c) {
$a;
return '';
};
I have no IDE to test. Still extension recognized int
in one place, but not description.
Suggested syntax is great but for telling how callback should look like, and there is no place to tell what each param means.
This is useful case for proposed syntax:
/**
* @param callable(int, string):string $callback Yup, I'm still for this syntax
*/
function iWillCallYouBack($callback) { /*...*/ }
iWillCallYouBack(function($myInt, $myString){// Extension can warn here: function should return string
$myInt; // on hover we have int type
})
\Closure<int, string, bool, string>
syntax is ok-ish, but does not deal with other callbacks and return type isn't obvious.
Of course, this doesn't exclude use with @var
. Every addition would be great, because now there is nothing to deal with closures and callbacks.
Psalm should support docblock on closures :link:Supported docblock annotations (screenshot formatted for readability)
Extension does not use description from
@param
with closures.Call typehinting:
Closure doesn't have description
Hover label
Doesn't have
type(fixed 1.3) nor descriptionClosure var hover
Here we have complete set of phpdoc
Inside Closure
Inside closure type is correctly recognized but not description
Version: vsc 1.38.1 / ext 1.2.3
Code: