Problem/Motivation

When using asymmetric visibility for a class property declaration in PHP 8.4, I discovered that PHPCS always reports the following error:

Missing member variable doc comment (Drupal.Commenting.VariableComment.Missing)

Steps to reproduce

Create the following file, then run phpcs -s --standard=Drupal,DrupalPractice on it:

<?php

/**
 * @file
 * This is a test comment.
 */

return new class() {

  /**
   * This is a test comment.
   *
   * @var array
   */
  public private(set) array $data = [];

};

You should see the superfluous error message from above, even though there is a doc comment.

Proposed resolution

TBD.

Remaining tasks

TBD.

User interface changes

n/a?

API changes

n/a?

Data model changes

n/a?

Issue fork coder-3554243

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

clayfreeman created an issue. See original summary.

klausi made their first commit to this issue’s fork.

  • klausi committed 9fa1180d on 9.x
    fix(VariableComment): Support asymmetric visibility on class property (#...
klausi’s picture

Version: 8.3.x-dev » 9.x-dev
Status: Active » Fixed

Merged a fix into 9.x, thanks for reporting!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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