-
-
Notifications
You must be signed in to change notification settings - Fork 192
Closed
Labels
Description
In PHP 8.0, I can insert an attribute block between a method declaration and the PHPDoc block, for example:
use ReflectionProperty;
final class MyProperty extends ReflectionProperty
{
/**
* {@inheritdoc}
*/
#[SomeAttribute]
public function getValue($object = null)
{
parent::getValue($object);
}
}If I do so, I get a CodeSniffer error like this:
FILE: /path/to/MyProperty.php
-------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Useless documentation comment with @inheritDoc.
| | (SlevomatCodingStandard.Commenting.UselessInheritDocComment.UselessInheritDocComment)
-------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------
If I remove the attribute, the error is gone. It seems as if the rule does not recognize that the PHPDoc block belongs to the method if an attribute block is inserted in between.
Reactions are currently unavailable