Improves coverage feedback

This commit is contained in:
Nuno Maduro
2022-09-16 17:47:29 +01:00
parent 462982bb28
commit 3d5271f512
3 changed files with 34 additions and 2 deletions

View File

@ -36,7 +36,21 @@ final class Coverage
*/
public static function isAvailable(): bool
{
return (new Runtime())->canCollectCodeCoverage();
$runtime = new Runtime();
if (! $runtime->canCollectCodeCoverage()) {
return false;
}
if ($runtime->hasXdebug()) {
if (version_compare((string) phpversion('xdebug'), '3.1', '>=')) {
if (! in_array('coverage', xdebug_info('mode'), true)) {
return false;
}
}
}
return true;
}
/**