Skip to content

Commit e2638e7

Browse files
Refactor
1 parent 8adf337 commit e2638e7

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

src/CodeCoverage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,15 @@ public function detectsDeadCode(): bool
384384
*/
385385
public function driverIsPcov(): bool
386386
{
387-
return $this->driver instanceof PcovDriver;
387+
return $this->driver->isPcov();
388388
}
389389

390390
/**
391391
* @internal
392392
*/
393393
public function driverIsXdebug(): bool
394394
{
395-
return $this->driver instanceof XdebugDriver;
395+
return $this->driver->isXdebug();
396396
}
397397

398398
/**

src/Driver/Driver.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ public function disableDeadCodeDetection(): void
120120
$this->detectDeadCode = false;
121121
}
122122

123+
public function isPcov(): bool
124+
{
125+
return false;
126+
}
127+
128+
public function isXdebug(): bool
129+
{
130+
return false;
131+
}
132+
123133
abstract public function nameAndVersion(): string;
124134

125135
abstract public function start(): void;

src/Driver/PcovDriver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ public function nameAndVersion(): string
6868
return 'PCOV ' . phpversion('pcov');
6969
}
7070

71+
public function isPcov(): true
72+
{
73+
return true;
74+
}
75+
7176
/**
7277
* @throws PcovNotAvailableException
7378
*/

src/Driver/XdebugDriver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ public function nameAndVersion(): string
125125
return 'Xdebug ' . phpversion('xdebug');
126126
}
127127

128+
public function isXdebug(): true
129+
{
130+
return true;
131+
}
132+
128133
/**
129134
* @throws XdebugNotAvailableException
130135
*/

0 commit comments

Comments
 (0)