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

Method tag is missing return by reference #158

Open
jaapio opened this issue Oct 28, 2022 · 2 comments · May be fixed by #166
Open

Method tag is missing return by reference #158

jaapio opened this issue Oct 28, 2022 · 2 comments · May be fixed by #166

Comments

@jaapio
Copy link
Contributor

jaapio commented Oct 28, 2022

The MethodTagValue doesn't contain an property returnsReference. This is not a very common option to use but we found a few of them in the wild.

Full blown example will look like this:

/** @method static Type &myMethod() description here */

I will provide a PR later when ready with other things.

@jaapio
Copy link
Contributor Author

jaapio commented Nov 15, 2022

Looks like this is much harder than I thought... the type parser consumes the tokens as types. so in my example, the return type will be Type & myMethod which is obviously wrong...

This requires some more time from my side to figure out how to do this. @rvanvelzen any suggestions? Should I use a rollback point to restore and make the type parser consume less in this case? Some look ahead is required here I think.

For reference: https://github.com/phpDocumentor/ReflectionDocBlock/blob/master/src/DocBlock/Tags/Method.php#L125

@rvanvelzen
Copy link
Contributor

It's probably best to leave the type parser alone, and with a little bit of hacking I came up with something that should work: https://gist.github.com/rvanvelzen/ff2d187490aa3a810902a4731e350995

Feel free to use it :)

@jaapio jaapio linked a pull request Nov 17, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants