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

Suggestion to use int/bool instead of integer/boolean in doc blocks #12055

Closed
VojtechH opened this issue Jul 30, 2016 · 4 comments · Fixed by #12671
Closed

Suggestion to use int/bool instead of integer/boolean in doc blocks #12055

VojtechH opened this issue Jul 30, 2016 · 4 comments · Fixed by #12671
Assignees
Milestone

Comments

@VojtechH
Copy link
Contributor

Yii currently uses long type names for int/bool in doc blocks:
https://github.com/yiisoft/yii2/blob/master/docs/internals/core-code-style.md#44-doc-blocks

I adopted this standard, however it always meant a certain discomfort for me since PhpStorm auto-generates PHPDoc stubs using shot type names. It made me submit a feature request to JetBrains to support long type names in auto-generated PHPDoc. Upon this request I was suggested to reconsider the usage of the long form at all as PHP 7 allows only the short form for type hinting.

Thus, I would suggest to consider this change in the Yii Code Style standards as well.

@PowerGamer1
Copy link
Contributor

PHP 7 allows only the short form for type hinting.

That's exactly the reason I use short forms in PHPDoc in my own PHP code. And for the same reason I use float instead of double too.

@samdark
Copy link
Member

samdark commented Jul 31, 2016

Yes. That makes perfect sense and I've just included the rule into PSR-12: php-fig/fig-standards@a77993b

Could be applied to Yii as well.

@samdark samdark added the status:ready for adoption Feel free to implement this issue. label Jul 31, 2016
@samdark samdark added this to the 2.0.x milestone Jul 31, 2016
@cebe
Copy link
Member

cebe commented Aug 2, 2016

need to adjust this array to allow correct links in the documentation generator if we change it: https://github.com/yiisoft/yii2-apidoc/blob/474e7b9be71f8627c79ece7605c1ca50957e1189/renderers/BaseRenderer.php#L104-L116

@samdark
Copy link
Member

samdark commented Aug 2, 2016

It should be adjusted anyway to include both forms since both are actually allowed by PHP except return types.

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

Successfully merging a pull request may close this issue.

4 participants