File tree 2 files changed +19
-10
lines changed
2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,13 @@ public function processCovers(
71
71
{
72
72
$ errors = [];
73
73
$ covers = (string ) $ phpDocTag ->value ;
74
+
75
+ if ($ covers === '' ) {
76
+ $ errors [] = RuleErrorBuilder::message ('@covers value does not specify anything. ' )->build ();
77
+
78
+ return $ errors ;
79
+ }
80
+
74
81
$ isMethod = strpos ($ covers , ':: ' ) !== false ;
75
82
$ fullName = $ covers ;
76
83
@@ -94,17 +101,12 @@ public function processCovers(
94
101
$ fullName
95
102
))->build ();
96
103
}
97
- } else {
98
- if ($ covers === '' ) {
99
- $ errors [] = RuleErrorBuilder::message ('@covers value does not specify anything. ' )->build ();
100
-
101
- return $ errors ;
102
- }
103
-
104
- if (!isset ($ method ) && $ this ->reflectionProvider ->hasFunction (new Name ($ covers , []), null )) {
105
- return $ errors ;
106
- }
104
+ } elseif (isset ($ method ) && $ this ->reflectionProvider ->hasFunction (new Name ($ method , []), null )) {
105
+ return $ errors ;
106
+ } elseif (!isset ($ method ) && $ this ->reflectionProvider ->hasFunction (new Name ($ className , []), null )) {
107
+ return $ errors ;
107
108
109
+ } else {
108
110
$ error = RuleErrorBuilder::message (sprintf (
109
111
'@covers value %s references an invalid %s. ' ,
110
112
$ fullName ,
Original file line number Diff line number Diff line change @@ -50,3 +50,10 @@ class CoversNothing extends \PHPUnit\Framework\TestCase
50
50
class CoversNotFullyQualified extends \PHPUnit \Framework \TestCase
51
51
{
52
52
}
53
+
54
+ /**
55
+ * @covers ::str_replace
56
+ */
57
+ class CoversGlobalFunction extends \PHPUnit \Framework \TestCase
58
+ {
59
+ }
You can’t perform that action at this time.
0 commit comments