Skip to content

Commit ca94167

Browse files
committed
CodeCoverage: Don’t check if enabled.
The CodeCoverage class, will throw an exception if there is no driver available.
1 parent f718953 commit ca94167

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/Listener/CodeCoverageListener.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class CodeCoverageListener implements EventSubscriberInterface
2828
private $reports;
2929
private $io;
3030
private $options;
31-
private $enabled;
3231
private $skipCoverage;
3332

3433
/**
@@ -51,7 +50,6 @@ public function __construct(ConsoleIO $io, CodeCoverage $coverage, array $report
5150
'format' => ['html'],
5251
];
5352

54-
$this->enabled = extension_loaded('xdebug') || (PHP_SAPI === 'phpdbg');
5553
$this->skipCoverage = $skipCoverage;
5654
}
5755

@@ -63,7 +61,7 @@ public function __construct(ConsoleIO $io, CodeCoverage $coverage, array $report
6361
*/
6462
public function beforeSuite(SuiteEvent $event) : void
6563
{
66-
if (!$this->enabled || $this->skipCoverage) {
64+
if ($this->skipCoverage) {
6765
return;
6866
}
6967

@@ -92,7 +90,7 @@ public function beforeSuite(SuiteEvent $event) : void
9290
*/
9391
public function beforeExample(ExampleEvent $event): void
9492
{
95-
if (!$this->enabled || $this->skipCoverage) {
93+
if ($this->skipCoverage) {
9694
return;
9795
}
9896

@@ -111,7 +109,7 @@ public function beforeExample(ExampleEvent $event): void
111109
*/
112110
public function afterExample(ExampleEvent $event): void
113111
{
114-
if (!$this->enabled || $this->skipCoverage) {
112+
if ($this->skipCoverage) {
115113
return;
116114
}
117115

@@ -123,13 +121,9 @@ public function afterExample(ExampleEvent $event): void
123121
*/
124122
public function afterSuite(SuiteEvent $event): void
125123
{
126-
if (!$this->enabled || $this->skipCoverage) {
124+
if ($this->skipCoverage) {
127125
if ($this->io && $this->io->isVerbose()) {
128-
if (!$this->enabled) {
129-
$this->io->writeln('No code coverage will be generated as neither Xdebug nor phpdbg was detected.');
130-
} elseif ($this->skipCoverage) {
131-
$this->io->writeln('Skipping code coverage generation');
132-
}
126+
$this->io->writeln('Skipping code coverage generation');
133127
}
134128

135129
return;

0 commit comments

Comments
 (0)