doyolabs /
code-coverage
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file is part of the doyo/code-coverage project. |
||
| 5 | * |
||
| 6 | * (c) Anthonius Munthi <https://itstoni.com> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | declare(strict_types=1); |
||
| 13 | |||
| 14 | namespace Doyo\Bridge\CodeCoverage\Environment; |
||
| 15 | |||
| 16 | use Doyo\Bridge\CodeCoverage\Driver\Dummy; |
||
| 17 | use Doyo\Bridge\CodeCoverage\Driver\PCOV; |
||
| 18 | use SebastianBergmann\CodeCoverage\Driver\HHVM; |
||
|
0 ignored issues
–
show
|
|||
| 19 | use SebastianBergmann\CodeCoverage\Driver\PHPDBG; |
||
| 20 | use SebastianBergmann\CodeCoverage\Driver\Xdebug; |
||
| 21 | use SebastianBergmann\Environment\Runtime as RuntimeEnvironment; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Class Runtime. |
||
| 25 | * |
||
| 26 | * @method bool isHHVM() |
||
| 27 | * @method bool isPHPDBG() |
||
| 28 | * @method bool hasXdebug() |
||
| 29 | * @method bool hasPHPDBGCodeCoverage() |
||
| 30 | * @method bool isPHP() |
||
| 31 | */ |
||
| 32 | final class Runtime implements RuntimeInterface |
||
| 33 | { |
||
| 34 | private $runtime; |
||
| 35 | |||
| 36 | 35 | public function __construct() |
|
| 37 | { |
||
| 38 | 35 | $this->runtime = new RuntimeEnvironment(); |
|
| 39 | } |
||
| 40 | |||
| 41 | 35 | public function getDriverClass(): string |
|
| 42 | { |
||
| 43 | 35 | $driverClass = Dummy::class; |
|
| 44 | |||
| 45 | // @codeCoverageIgnoreStart |
||
| 46 | if ($this->isHHVM()) { |
||
| 47 | $driverClass = HHVM::class; |
||
| 48 | } |
||
| 49 | |||
| 50 | if ($this->isPHPDBG()) { |
||
| 51 | $driverClass = PHPDBG::class; |
||
| 52 | } |
||
| 53 | |||
| 54 | if ( |
||
| 55 | version_compare(PHP_VERSION, '7.0', '>') |
||
| 56 | && $this->hasPCOV() |
||
| 57 | ) { |
||
| 58 | //$driverClass = PCOV::class; |
||
| 59 | } |
||
| 60 | |||
| 61 | if ($this->hasXdebug()) { |
||
| 62 | $driverClass = Xdebug::class; |
||
| 63 | } |
||
| 64 | // @codeCoverageIgnoreEnd |
||
| 65 | |||
| 66 | 35 | return $driverClass; |
|
| 67 | } |
||
| 68 | |||
| 69 | 116 | public function hasPCOV() |
|
| 70 | { |
||
| 71 | 116 | return $this->isPHP() && \extension_loaded('pcov') && ini_get('pcov.enabled'); |
|
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Returns true when Xdebug is supported or |
||
| 76 | * the runtime used is PHPDBG. |
||
| 77 | */ |
||
| 78 | 116 | public function canCollectCodeCoverage(): bool |
|
| 79 | { |
||
| 80 | 116 | return $this->hasXdebug() || $this->hasPCOV() || $this->hasPHPDBGCodeCoverage(); |
|
| 81 | } |
||
| 82 | |||
| 83 | 116 | public function __call($name, $arguments) |
|
| 84 | { |
||
| 85 | 116 | return \call_user_func_array([$this->runtime, $name], $arguments); |
|
| 86 | } |
||
| 87 | } |
||
| 88 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths