Problem/Motivation

The sniff Drupal.Commenting.VariableComment.Missing is reporting errors on some variables that do have a comment. For example, this from core/modules/node/src/Plugin/views/row/Rss.php.

   /**
    * The base field for this row plugin.
    */
   // phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName
   public string $base_field = 'nid';

Steps to reproduce

Proposed resolution

Add Drupal.Commenting.VariableComment.Missing to the existing phpcs line.

The sniff can't be enabled for this set of changes. These are false positives that needs to be handled individually and are not in a single directory path. Once this issue is committed it should be possible to enable the sniff for the relevant file paths in the sibling issues.

Remaining tasks

Make a follow up to remove the ignore changes when #3477601: False positives with Drupal.Commenting.VariableComment.Missing is fixed.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3477614

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

quietone created an issue. See original summary.

quietone’s picture

Status: Active » Needs review
Issue tags: +Needs followup
smustgrave’s picture

Status: Needs review » Needs work

Think the issue in the summary is wrong. That's pointing to an unsupported contrib module.

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs followup
larowlan’s picture

Status: Reviewed & tested by the community » Needs review

Couple of questions.

Should we also be enabling the rule in phpcs.xml at the same time?

quietone’s picture

Issue summary: View changes

The rule can't be enabled on this set of files as they are not in a single filepath. Once this issue is committed it should be possible to start enabling the sniff for sets of files in the sibling issues. I updated the IS to clarify this.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe feedback for this one has been addressed

  • larowlan committed 4012cf0c on 11.x
    Issue #3477614 by quietone: Ignore VariableComment.Missing as needed
    
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 11.x - thanks!

  • larowlan committed 1a34d1b6 on 11.1.x
    Issue #3477614 by quietone: Ignore VariableComment.Missing as needed
    
    (...
larowlan’s picture

Version: 11.x-dev » 11.1.x-dev

I backported this to 11.1.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.