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

Remove & in phpdoc #1232

Closed
wants to merge 1 commit into from
Closed

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Sep 16, 2021

Some tools like phpstan/phpdoc-parser doesn't support @param int &$consumed syntax.
By removing the &, it would allow phpstan to better understand stubs provided by phpstorm.

Also it's useless as the & is already present in the native signature and it's not in the standard either: https://docs.phpdoc.org/latest/guide/references/phpdoc/tags/param.html

Ref: phpstan/phpstan#5636 (comment)

@DmitryTronin
Copy link
Contributor

DmitryTronin commented Sep 16, 2021

I dug this a bit and found why the &'s are there.
They was added a year ago: #892. While working on this, a PR to support & in PHPDocs was created & accepted: phpDocumentor/ReflectionDocBlock#254 so, technically, PHPDocs are supporting this.
I would appreciate if @voku could comment here describing why the &$ syntax in PHPDocs isn't "useless". Unfortunately I can't recall any of these usages right now.

@VincentLanglet
Copy link
Contributor Author

For the record, I added the &$ syntax to the phpstan/parser phpstan/phpdoc-parser#83 so I don't know if this PR is still necessary (it should at least not be needed for phpstan).

@DmitryTronin
Copy link
Contributor

Thanks for the update. We'll leave our stubs unchanged then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants