slevomat / coding-standard

Slevomat Coding Standard for PHP_CodeSniffer provides many useful sniffs
MIT License
1.37k stars 170 forks source link

PHPStan type-aliases are converted to FQCN #1676

Open mxr576 opened 2 months ago

mxr576 commented 2 months ago

When you use type aliases by PHPStan, even if you use a @phpstan- prefixed annotation, like @phpstan-param, the SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation rule auto-corrects it to a FQCN and with that ruins it.

Suggested solution: Add @phpstan-param,@phpstan-return,@phpstan-var (any other?) to the ignoredAnnotationNames as sane defaults.

kukulich commented 2 months ago

Will you prepare PR please?

mxr576 commented 2 months ago

If the suggested fix is acceptable, gladly! :)

mxr576 commented 2 months ago

Although, it came to my mind that is there a realistic scenario where @phpstan-param is used to specify a class/interface reference instead of @param? Is these a scenario where somebody would like to override what is in @param like this and that is also a class/interface reference? I hope not...