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

Allow no comment for a constructor where needed #440

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

fredden
Copy link
Member

@fredden fredden commented Mar 20, 2023

While working on magento/magento2#37020, I noticed that the Magento coding standard was requiring a docblock comment for the following constructor:

https://github.com/magento/magento2/blob/322047d01d98b584892c6058ed93c5bf6715add8/lib/internal/Magento/Framework/Data/Tree.php#L28-L33

    public function __construct()
    {
        $this->_nodes = new NodeCollection($this);
    }

Typically there is no 'short description' required for constructors, but a docblock listing each @param is required (even if it's purely a duplicate of what PHP says, but that's a separate issue/gripe). However, as this particular constructor does not have any parameters, I consider the requirement for a docblock an error.

This pull request adds a special case for the __construct() method to avoid a useless (or empty) comment being added.

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

Successfully merging this pull request may close these issues.

3 participants