Page MenuHomePhabricator

@coversDefaultClass should be allowed on traits as well as classes (MediaWiki.Commenting.PhpunitAnnotations.NotClass)
Closed, DeclinedPublicBUG REPORT

Description

@coversDefaultClass seems to work fine on a trait as well as a class, but I get this error:

----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 13 | WARNING | The phpunit annotation @coversDefaultClass should
    |         | only be used in class level comments.
    |         | (MediaWiki.Commenting.PhpunitAnnotations.NotClass)
----------------------------------------------------------------------

I tried poking a little at the code for our sniff rules but didn't know how to fix the problem.

Event Timeline

Also @covers and presumably other things.

Actually, @covers might not actually work on trait-level comments (PHPUnit bug?).

For the record, @coversDefaultClass seems not to work properly on HHVM either, although on PHP I didn't get any errors. So maybe the sniff is a good idea, at least for now.

HHVM was using an older version of phpunit, so it may be fixed in the newer one (phpunit 6 or later).

@Simetrical is this still needed? If so can you provide an example patch that fails but should pass?

Per lack of response above, does not appear needed