File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,13 @@ public function processCovers(
7171 {
7272 $ errors = [];
7373 $ 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+
7481 $ isMethod = strpos ($ covers , ':: ' ) !== false ;
7582 $ fullName = $ covers ;
7683
@@ -94,17 +101,12 @@ public function processCovers(
94101 $ fullName
95102 ))->build ();
96103 }
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 ;
107108
109+ } else {
108110 $ error = RuleErrorBuilder::message (sprintf (
109111 '@covers value %s references an invalid %s. ' ,
110112 $ fullName ,
Original file line number Diff line number Diff line change @@ -50,3 +50,10 @@ class CoversNothing extends \PHPUnit\Framework\TestCase
5050class CoversNotFullyQualified extends \PHPUnit \Framework \TestCase
5151{
5252}
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