slevomat / coding-standard

Slevomat Coding Standard for PHP_CodeSniffer provides many useful sniffs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to annotate class constant with `@var`

janedbal opened this issue · comments

I'm unable to properly annotate class const, error of SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat is always reported as there is no $ in there:

class Example
{

    /**
     * @var list<MyEnum> For PHPStorm
     */
    final public const ENUM_LIST = [
        MyEnum::One
        MyEnum::Two,
    ];
}

Error:

Invalid inline documentation comment format "@var list<MyEnum> For PHPStorm", expected "@var type $variableName Optional description"

Note: this is rarely needed, but sometimes PHPStorm does not properly infer types from consts.

Thank you for your report.

Fixed in 789275d

Oh, the problem was in final const, thanks!

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.