Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #2
Arkener CreditAttribution: Arkener at INDICIA commentedPR: https://github.com/pfrenssen/coder/pull/63
Comment #4
klausiCommitted, thanks!