Issues (142)

Environment/Runtime.php (4 issues)

1
<?php
2
3
/*
4
 * This file is part of the doyo/code-coverage project.
5
 *
6
 * (c) Anthonius Munthi <[email protected]>
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 SebastianBergmann\CodeCoverage\Driver\HHVM;
0 ignored issues
show
The type SebastianBergmann\CodeCoverage\Driver\HHVM was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use SebastianBergmann\CodeCoverage\Driver\PHPDBG;
0 ignored issues
show
The type SebastianBergmann\CodeCoverage\Driver\PHPDBG was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use SebastianBergmann\CodeCoverage\Driver\Xdebug;
0 ignored issues
show
The type SebastianBergmann\CodeCoverage\Driver\Xdebug was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
use SebastianBergmann\Environment\Runtime as RuntimeEnvironment;
0 ignored issues
show
The type SebastianBergmann\Environment\Runtime was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
22
/**
23
 * Class Runtime.
24
 *
25
 * @method bool isHHVM()
26
 * @method bool isPHPDBG()
27
 * @method bool hasXdebug()
28
 * @method bool hasPHPDBGCodeCoverage()
29
 */
30
final class Runtime implements RuntimeInterface
31
{
32
    private $runtime;
33
34
    public function __construct()
35
    {
36
        $this->runtime = new RuntimeEnvironment();
37
    }
38
39
    public function getDriverClass(): string
40
    {
41
        $driverClass = Dummy::class;
42
43
        // @codeCoverageIgnoreStart
44
        if ($this->isHHVM()) {
45
            $driverClass = HHVM::class;
46
        }
47
48
        if ($this->isPHPDBG()) {
49
            $driverClass = PHPDBG::class;
50
        }
51
52
        if ($this->hasXdebug()) {
53
            $driverClass =  Xdebug::class;
54
        }
55
        // @codeCoverageIgnoreEnd
56
57
        return $driverClass;
58
    }
59
60
    /**
61
     * Returns true when Xdebug is supported or
62
     * the runtime used is PHPDBG.
63
     */
64
    public function canCollectCodeCoverage(): bool
65
    {
66
        return $this->runtime->canCollectCodeCoverage();
67
    }
68
69
    public function __call($name, $arguments)
70
    {
71
        return \call_user_func_array([$this->runtime, $name], $arguments);
72
    }
73
}
74