FakeDriver::start()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 1
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Paraunit\Proxy\Coverage;
6
7
use PHPUnit\Runner\Version;
8
use SebastianBergmann\CodeCoverage\Driver\Driver;
9
10
/**
11
 * Class FakeDriver
12
 * @package Paraunit\Proxy\Coverage
13
 */
14 1
if (version_compare(Version::id(), '7.0.0', '<')) {
15
    class FakeDriver implements Driver
16
    {
17
        public function start($determineUnusedAndDead = true)
18
        {
19
            throw new \RuntimeException('This is a fake implementation, it shouldn\'t be used!');
20
        }
21
22
        public function stop()
23
        {
24
            throw new \RuntimeException('This is a fake implementation, it shouldn\'t be used!');
25
        }
26
    }
27
} else {
28
    class FakeDriver implements Driver
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type Paraunit\Proxy\Coverage\FakeDriver has been defined more than once; this definition is ignored, only the first definition in this file (L15-26) is considered.

This check looks for classes that have been defined more than once in the same file.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
29
    {
30 1
        public function start(bool $determineUnusedAndDead = true): void
31
        {
32 1
            throw new \RuntimeException('This is a fake implementation, it shouldn\'t be used!');
33
        }
34
35 1
        public function stop(): array
36
        {
37 1
            throw new \RuntimeException('This is a fake implementation, it shouldn\'t be used!');
38
        }
39
    }
40
}
41