Problem/Motivation

The Drupal.Commenting.VariableComment currently throws a false positive when using the PHP7.4 typed properties. For example:

class Bar {

  /**
   * The test property.
   *
   * @var \Foo\Bar
   */
  protected Bar $foo;

}

Currently displays the current error, even though a variable comment has been provided.
ERROR | [ ] Missing member variable doc comment

This issue has been resolved on the PHP_CodeSniffer project via issue https://github.com/squizlabs/PHP_CodeSniffer/issues/2517

Proposed resolution

Add support for typed properties while still enforcing the current variable comment usage. This means the following will not allowed:

class Bar {

  /**
   * The test property.
   */
  protected Bar $foo;

}

Comments

Arkener created an issue. See original summary.

Arkener’s picture

Status: Active » Needs review

  • klausi committed 4d11178 on 8.x-3.x authored by Arkener
    feat(VariableComment): Add support for PHP 7.4 typed properties (#...
klausi’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

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