-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Technical guidelines > Abstract classes MUST NOT be marked as public @api #25133
Technical guidelines > Abstract classes MUST NOT be marked as public @api #25133
Conversation
Hi @lfluvisotto. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
app/code/Magento/Backend/Console/Command/AbstractCacheCommand.php
Outdated
Show resolved
Hide resolved
779fcad
to
093f256
Compare
We can't remove existing |
So the "Technical guidelines" > "2.8. Abstract classes MUST NOT be marked as public @api" is incorrect ? Should we remove this item from devdocs ? Or the "MUST NOT" in the item 2.8 needs to be more detailed, for example, only for third party source code (third party modules) and not for magento source code ? The php code sniffer with standard magento coding is already validating this rule and impacting us, every moment generates warning. Do you think we'd better add "phpcs: disable Magento2.Classes.AbstractApi" in all abstract magento source code classes where there "@api" for php code sniffer to stop generating warnings? |
Yes, I'd recommend to suppress validation for specific files. Regarding the rule itself, no, I'd not remove it. New code should comply with it. But old code needs time and effort to be refactored, so that it can comply with Tech Guidelines. Having the rule helps to evolve code in the desired direction. |
093f256
to
55cc5cd
Compare
83c0bd9
to
4ca0e63
Compare
9ca7959
to
312fa0f
Compare
…houldn’t have braces
8b30d92
to
eb32b0c
Compare
…ion if they add information beyond what the constant name supplies
…must be consistent
eb32b0c
to
05a397b
Compare
@@ -13,6 +13,8 @@ | |||
* | |||
* phpcs:disable Magento2.Classes.AbstractApi | |||
* Backend grid item abstract renderer | |||
* | |||
* phpcs:disable Magento2.Classes.AbstractApi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class already contains it. this line above, please fix duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lfluvisotto,
Your changes looks good. Could you fix static test?
Also note that static test failures related to not meaningful phpdoc blocks could be just removed.
Related PR in coding standard: magento/magento-coding-standard#171
@lfluvisotto I am closing this PR now due to inactivity. |
Hi @lfluvisotto, thank you for your contribution! |
Technical guidelines > Abstract classes MUST NOT be marked as public @api
Description (*)
According to Technical guidelines > Abstract classes MUST NOT be marked as public @api.
https://devdocs.magento.com/guides/v2.3/coding-standards/technical-guidelines.html
Having the tag @api in abstract classes generates every time warning when using php code sniffer + coding standard magento.
As discussed in the comments of this pull request with @buskamuza, we cannot simply remove the @api tag from source code for compatibility with third party modules (extension developers).
However we cannot keep this warning if we want to have all source code covered and validated with php code sniffer + magento standard coding.
The solution is to add the line "phpcs: disable Magento2.Classes.AbstractApi" to all abstract classes that have the @api tag as has already been done in some abstract classes.
The purpose of this pull request is to increase and intensify coverage and validations with php code sniffer + magento standard coding.
Fixed Issues (if relevant)
N/A
Manual testing scenarios (*)
N/A
Questions or comments
N/A
Contribution checklist (*)