★ wanayoo — archive 1999 https://github.com/phpDocumentor/ReflectionDocBlock/issues/83Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for callable definitions #83

Open
kelunik opened this issue Sep 5, 2016 · 4 comments
Open

Support for callable definitions #83

kelunik opened this issue Sep 5, 2016 · 4 comments

Comments

@kelunik
Copy link
Contributor

@kelunik kelunik commented Sep 5, 2016

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.

@staabm
Copy link

@staabm staabm commented Sep 5, 2016 •

the signature should also support return types, e.g.

/**
 * Summary.
 *
 * @param callable(Throwable|Exception $error):MyReturnType $callback
 *         Callback executed upon uncaught errors.
 */
@kelunik
Copy link
Contributor Author

@kelunik kelunik commented Sep 5, 2016 •

This will complicate the parser, as spaces can't be used to separate the arguments anymore.

callable(Throwable|Exception $error, string $foo): MyReturnType
                            ^       ^      ^      ^
@jaapio
Copy link
Member

@jaapio jaapio commented Jul 14, 2017

@mvriel I think we should add this in the future. It makes a lot of sense to have a description for the exprected callable.

@jaapio jaapio added the enhancement label Jul 14, 2017
@jaapio
Copy link
Member

@jaapio jaapio commented Aug 4, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.