Fix covers function to accept traits

This commit is contained in:
Sandro Gehri
2023-11-08 14:22:21 +01:00
parent 772448db80
commit aaee0e420b

View File

@ -526,8 +526,8 @@ final class TestCall
$isTrait = trait_exists($classOrFunction);
$isFunction = function_exists($classOrFunction);
if (! $isClass && ! $isFunction) {
throw new InvalidArgumentException(sprintf('No class or method named "%s" has been found.', $classOrFunction));
if (! $isClass && ! $isTrait && ! $isFunction) {
throw new InvalidArgumentException(sprintf('No class, trait or method named "%s" has been found.', $classOrFunction));
}
if ($isClass) {