You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently annotation errors are bound to the element they're for - either T_VARIABLE or T_FUNCTION.
The error should be reported on the line (pointer) of the annotation itself.
Example
<?phpclassFoo
{
/** * @var integer */public$foo;
/** * Doing foo. * @param int $foo * @return int */publicfunctionfoo(int$foo) : int
{
return123;
}
}
Actual output
8 | ERROR | [x] Expected "int" but found "integer" in @var annotation. (SlevomatCodingStandard.TypeHints.LongTypeHints.UsedLongTypeHint)
15 | ERROR | [x] Method \Foo::foo() has useless @return annotation. (SlevomatCodingStandard.TypeHints.TypeHintDeclaration.UselessReturnAnnotation)
15 | ERROR | [x] Method \Foo::foo() has useless @param annotation for parameter $foo. (SlevomatCodingStandard.TypeHints.TypeHintDeclaration.UselessParameterAnnotation)
Expected output
6 | ERROR | [x] Expected "int" but found "integer" in @var annotation. (SlevomatCodingStandard.TypeHints.LongTypeHints.UsedLongTypeHint)
12 | ERROR | [x] Method \Foo::foo() has useless @return annotation. (SlevomatCodingStandard.TypeHints.TypeHintDeclaration.UselessReturnAnnotation)
13 | ERROR | [x] Method \Foo::foo() has useless @param annotation for parameter $foo. (SlevomatCodingStandard.TypeHints.TypeHintDeclaration.UselessParameterAnnotation)
This currently makes trouble in Doctrine DBAL (doctrine/dbal#2996, doctrine/dbal#2998) where we use line-based CS validation (so new/changed code obeys CS rules, but existing is still not compliant due the amount of conflicts it would cause).
Supporting this in UselessLongTypeHint sniff should be easy, just by storing $pointer in Annotation itself, but TypeHintDeclaration sniff may not be that trivial.
The text was updated successfully, but these errors were encountered:
Currently annotation errors are bound to the element they're for - either T_VARIABLE or T_FUNCTION.
The error should be reported on the line (pointer) of the annotation itself.
Example
Actual output
Expected output
This currently makes trouble in Doctrine DBAL (doctrine/dbal#2996, doctrine/dbal#2998) where we use line-based CS validation (so new/changed code obeys CS rules, but existing is still not compliant due the amount of conflicts it would cause).
Supporting this in UselessLongTypeHint sniff should be easy, just by storing
$pointer
in Annotation itself, but TypeHintDeclaration sniff may not be that trivial.The text was updated successfully, but these errors were encountered: