Support for callable definitions
There should be support for callable definitions as types.
/**
* Summary.
*
* @param callable(Throwable|Exception $error) $callback
* Callback executed upon uncaught errors.
*/
Currently this just makes the block fail to parse entirely.
the signature should also support return types, e.g.
/**
* Summary.
*
* @param callable(Throwable|Exception $error):MyReturnType $callback
* Callback executed upon uncaught errors.
*/
This will complicate the parser, as spaces can't be used to separate the arguments anymore.
callable(Throwable|Exception $error, string $foo): MyReturnType
^ ^ ^ ^
@mvriel I think we should add this in the future. It makes a lot of sense to have a description for the exprected callable.
When looking at this feature request it seemed very plausible to have this. On the other hand It would be strange to add arguments to the callable type of our type resolver. Since the php type doesn't have any arguments.
I don't know yet if and how we can implement this. Typically the arguments should be part of a some how complex description. Since we cannot modify the callable type for this. It looks like our current architecture is not able to support this use case.
I will leave this open for further discussion. Maybe we will find a solution when PRS-5 is continued
Update on this one, we added support for callables in the type resolver. This will be part of our next release.