Problem/Motivation

This code block is reported as failing the sniff, Drupal.Commenting.VariableComment.Missing. The variable does has a comment.

  /**
   * The search score.
   */
  // phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName
  public string $search_score;

See https://git.drupalcode.org/project/drupal/-/blame/11.x/core/modules/sear...

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

quietone created an issue. See original summary.

  • klausi authored c43cb34e on 8.3.x
    fix(LineLength): Do not check phpcs:ignore lines for line length (#...
klausi’s picture

Thanks for reporting!

As a first fix we should allow PHPCS ignore comments to be on the same line, pushed https://github.com/pfrenssen/coder/pull/246
Now this works:

class Test {

  /**
   * The search score.
   */
  public string $search_score; // phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName

}

I'm not a big fan of the extra line you want in the issue summary, but maybe we can also make that work easily.

klausi’s picture

Status: Active » Needs review

Confirmed, easy to fix: https://github.com/pfrenssen/coder/pull/247

That exposed Drupal core coding standard problems with wrong tag order on member variable comments. I put those on ignore for now:
lib/Drupal/Core/Entity/EntityType.php
lib/Drupal/Core/Recipe/RecipeInputFormTrait.php
lib/Drupal/Core/Form/FormState.php
modules/migrate/src/Plugin/Migration.php
modules/views/src/ViewExecutable.php
modules/views/src/Plugin/views/style/StylePluginBase.php

  • klausi authored 032364c9 on 8.3.x
    fix(VariableComment): Allow phpcs:ignore comments before member...
klausi’s picture

Status: Needs review » Fixed

And merged!

This will need a new Coder release 8.3.27 and then Drupal core needs to update to that. Will probably do that next week or so.

Status: Fixed » Closed (fixed)

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