Skip to content

Commit 277a9bf

Browse files
staabmsebastianbergmann
authored andcommitted
Update File.php
1 parent 7957d58 commit 277a9bf

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Report/Html/Renderer/File.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -777,14 +777,12 @@ private function renderBranchStructure(FileNode $node): string
777777

778778
ksort($coverageData);
779779

780+
/** @var ProcessedFunctionCoverageData $methodData */
780781
foreach ($coverageData as $methodName => $methodData) {
781-
if (!$methodData['branches']) {
782-
continue;
783-
}
784-
785782
$branchStructure = '';
786783

787-
foreach ($methodData['branches'] as $branch) {
784+
/** @var ProcessedBranchCoverageData $branch */
785+
foreach ($methodData->branches as $branch) {
788786
$branchStructure .= $this->renderBranchLines($branch, $codeLines, $testData);
789787
}
790788

@@ -802,14 +800,14 @@ private function renderBranchStructure(FileNode $node): string
802800
/**
803801
* @param list<string> $codeLines
804802
*/
805-
private function renderBranchLines(array $branch, array $codeLines, array $testData): string
803+
private function renderBranchLines(ProcessedBranchCoverageData $branch, array $codeLines, array $testData): string
806804
{
807805
$linesTemplate = new Template($this->templatePath . 'lines.html.dist', '{{', '}}');
808806
$singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}');
809807

810808
$lines = '';
811809

812-
$branchLines = range($branch['line_start'], $branch['line_end']);
810+
$branchLines = range($branch->line_start, $branch->line_end);
813811
sort($branchLines); // sometimes end_line < start_line
814812

815813
/** @var int $line */
@@ -821,7 +819,7 @@ private function renderBranchLines(array $branch, array $codeLines, array $testD
821819
$popoverContent = '';
822820
$popoverTitle = '';
823821

824-
$numTests = count($branch['hit']);
822+
$numTests = count($branch->hit);
825823

826824
if ($numTests === 0) {
827825
$trClass = 'danger';
@@ -835,7 +833,7 @@ private function renderBranchLines(array $branch, array $codeLines, array $testD
835833
$popoverTitle = '1 test covers this branch';
836834
}
837835

838-
foreach ($branch['hit'] as $test) {
836+
foreach ($branch->hit as $test) {
839837
if ($lineCss === 'covered-by-large-tests' && $testData[$test]['size'] === 'medium') {
840838
$lineCss = 'covered-by-medium-tests';
841839
} elseif ($testData[$test]['size'] === 'small') {

0 commit comments

Comments
 (0)