Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
allow_failures:
- stage: Static Analysis (informative)
- stage: Code Coverage
- php: nightly


dist: xenial
Expand Down
12 changes: 8 additions & 4 deletions src/CodeCoverage/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class Collector
public static function detectEngines(): array
{
return array_filter([
extension_loaded('pcov') ? self::ENGINE_PCOV : null,
defined('PHPDBG_VERSION') ? self::ENGINE_PHPDBG : null,
extension_loaded('xdebug') ? self::ENGINE_XDEBUG : null,
extension_loaded('pcov') ? [self::ENGINE_PCOV, phpversion('pcov')] : null,
defined('PHPDBG_VERSION') ? [self::ENGINE_PHPDBG, PHPDBG_VERSION] : null,
extension_loaded('xdebug') ? [self::ENGINE_XDEBUG, phpversion('xdebug')] : null,
]);
}

Expand All @@ -52,7 +52,11 @@ public static function start(string $file, string $engine): void
if (self::isStarted()) {
throw new \LogicException('Code coverage collector has been already started.');

} elseif (!in_array($engine, self::detectEngines(), true)) {
} elseif (!in_array(
$engine,
array_map(function (array $engineInfo) { return $engineInfo[0]; }, self::detectEngines()),
true
)) {
throw new \LogicException("Code coverage engine '$engine' is not supported.");
}

Expand Down
Loading