Skip to content

Commit f6eb417

Browse files
Revert "Only pass ProcessedCodeCoverageData object and tests array to Builder::build() method"
This reverts commit 61d610c.
1 parent 25b4dd5 commit f6eb417

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/CodeCoverage.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ public function __construct(Driver $driver, Filter $filter)
7575
*/
7676
public function getReport(): Directory
7777
{
78-
return (new Builder($this->analyser()))->build(
79-
$this->getData(),
80-
$this->getTests()
81-
);
78+
return (new Builder($this->analyser()))->build($this);
8279
}
8380

8481
/**

src/Node/Builder.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use function str_replace;
2222
use function str_starts_with;
2323
use function substr;
24+
use SebastianBergmann\CodeCoverage\CodeCoverage;
2425
use SebastianBergmann\CodeCoverage\Data\ProcessedCodeCoverageData;
2526
use SebastianBergmann\CodeCoverage\StaticAnalysis\FileAnalyser;
2627

@@ -36,20 +37,19 @@ public function __construct(FileAnalyser $analyser)
3637
$this->analyser = $analyser;
3738
}
3839

39-
/**
40-
* @psalm-param array<string, array{size: string, status: string}> $tests
41-
*/
42-
public function build(ProcessedCodeCoverageData $data, array $tests): Directory
40+
public function build(CodeCoverage $coverage): Directory
4341
{
44-
// clone because path munging is destructive to the original data
45-
$data = clone $data;
42+
$data = clone $coverage->getData(); // clone because path munging is destructive to the original data
4643
$commonPath = $this->reducePaths($data);
47-
$root = new Directory($commonPath, null);
44+
$root = new Directory(
45+
$commonPath,
46+
null
47+
);
4848

4949
$this->addItems(
5050
$root,
5151
$this->buildDirectoryStructure($data),
52-
$tests
52+
$coverage->getTests()
5353
);
5454

5555
return $root;

0 commit comments

Comments
 (0)