Skip to content

Commit 4d64574

Browse files
committed
Transform Xdebug driver response to consistent structure
Add branch coverage flags to Command and Runner
1 parent 2c37a2a commit 4d64574

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Driver/Xdebug.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,21 @@ public function setDetermineBranchCoverage(bool $flag): void
8686
private function cleanup(array $data): array
8787
{
8888
foreach (\array_keys($data) as $file) {
89-
unset($data[$file][0]);
89+
if (!isset($data[$file]['lines'])) {
90+
$data[$file] = ['lines' => $data[$file]];
91+
}
92+
if (!isset($data[$file]['functions'])) {
93+
$data[$file]['functions'] = [];
94+
}
95+
96+
unset($data[$file]['lines'][0]);
9097

9198
if (\strpos($file, 'xdebug://debug-eval') !== 0 && \file_exists($file)) {
9299
$numLines = $this->getNumberOfLinesInFile($file);
93100

94-
foreach (\array_keys($data[$file]) as $line) {
101+
foreach (\array_keys($data[$file]['lines']) as $line) {
95102
if ($line > $numLines) {
96-
unset($data[$file][$line]);
103+
unset($data[$file]['lines'][$line]);
97104
}
98105
}
99106
}

0 commit comments

Comments
 (0)