Skip to content

Allow no comment for a constructor where needed#440

Open
fredden wants to merge 3 commits intomagento:developfrom
fredden:allow-no-comment-constructor
Open

Allow no comment for a constructor where needed#440
fredden wants to merge 3 commits intomagento:developfrom
fredden:allow-no-comment-constructor

Conversation

@fredden
Copy link
Copy Markdown
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