Skip to content

Commit

Permalink
Merge commit 'd77af96' into 1.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 9, 2023
2 parents 75f87d4 + d77af96 commit c5ace3a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Rules/PHPUnit/CoversHelper.php
Expand Up @@ -95,6 +95,12 @@ public function processCovers(
))->build();
}
} else {
if ($covers === '') {
$errors[] = RuleErrorBuilder::message('@covers value does not specify anything.')->build();

return $errors;
}

if (!isset($method) && $this->reflectionProvider->hasFunction(new Name($covers, []), null)) {
return $errors;
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Rules/PHPUnit/ClassCoversExistsRuleTest.php
Expand Up @@ -36,6 +36,10 @@ public function testRule(): void
'@covers value \Not\A\Class references an invalid class or function.',
31,
],
[
'@covers value does not specify anything.',
43,
],
]);
}

Expand Down
7 changes: 7 additions & 0 deletions tests/Rules/PHPUnit/data/class-coverage.php
Expand Up @@ -36,3 +36,10 @@ function testable(): void
{

}

/**
* @covers
*/
class CoversNothing extends \PHPUnit\Framework\TestCase
{
}

0 comments on commit c5ace3a

Please sign in to comment.