File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,17 @@ public function processCovers(
105105 return $ errors ;
106106 }
107107
108- $ errors [] = RuleErrorBuilder::message (sprintf (
108+ $ error = RuleErrorBuilder::message (sprintf (
109109 '@covers value %s references an invalid %s. ' ,
110110 $ fullName ,
111111 $ isMethod ? 'method ' : 'class or function '
112- ))->build ();
112+ ));
113+
114+ if (strpos ($ className , '\\' ) === false ) {
115+ $ error ->tip ('The @covers annotation requires a fully qualified name. ' );
116+ }
117+
118+ $ errors [] = $ error ->build ();
113119 }
114120 return $ errors ;
115121 }
Original file line number Diff line number Diff line change @@ -40,6 +40,11 @@ public function testRule(): void
4040 '@covers value does not specify anything. ' ,
4141 43 ,
4242 ],
43+ [
44+ '@covers value NotFullyQualified references an invalid class or function. ' ,
45+ 50 ,
46+ 'The @covers annotation requires a fully qualified name. ' ,
47+ ],
4348 ]);
4449 }
4550
Original file line number Diff line number Diff line change @@ -43,3 +43,10 @@ function testable(): void
4343class CoversNothing extends \PHPUnit \Framework \TestCase
4444{
4545}
46+
47+ /**
48+ * @covers NotFullyQualified
49+ */
50+ class CoversNotFullyQualified extends \PHPUnit \Framework \TestCase
51+ {
52+ }
You can’t perform that action at this time.
0 commit comments