File tree 3 files changed +20
-2
lines changed
3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,17 @@ public function processCovers(
105
105
return $ errors ;
106
106
}
107
107
108
- $ errors [] = RuleErrorBuilder::message (sprintf (
108
+ $ error = RuleErrorBuilder::message (sprintf (
109
109
'@covers value %s references an invalid %s. ' ,
110
110
$ fullName ,
111
111
$ 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 ();
113
119
}
114
120
return $ errors ;
115
121
}
Original file line number Diff line number Diff line change @@ -40,6 +40,11 @@ public function testRule(): void
40
40
'@covers value does not specify anything. ' ,
41
41
43 ,
42
42
],
43
+ [
44
+ '@covers value NotFullyQualified references an invalid class or function. ' ,
45
+ 50 ,
46
+ 'The @covers annotation requires a fully qualified name. ' ,
47
+ ],
43
48
]);
44
49
}
45
50
Original file line number Diff line number Diff line change @@ -43,3 +43,10 @@ function testable(): void
43
43
class CoversNothing extends \PHPUnit \Framework \TestCase
44
44
{
45
45
}
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