Add option to ignore missing function doc comments for private methods

Created on 10 January 2024, 6 months ago

Problem/Motivation

I think it would be useful to have the option to ignore the 'Missing function doc comment' error for private and/or protected methods.

This feature is already implemented for normal PHPCS, using the following in the phpcs.xml file:

<rule ref="PEAR.Commenting.FunctionComment">
    <properties>
      <property name="minimumVisibility" value="protected" />
    </properties>
  </rule>

A rough fix you can currently do is to disable Drupal.Commenting.FunctionComment and enable the PEAR equivalent using the above code. However, this gives another error 'Missing @return tag in function comment', since PEAR expects @return in PHPDocs in places where the Drupal standard does not (e.g because @inheritdoc).

I'm new to Drupal and PHP, so I am unsure how to answer the remaining headings of the default issue template.

✨ Feature request
Status

Active

Version

8.3

Component

Coder Sniffer

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024