Skip to content

Commit adb03c0

Browse files
committed
Update File.php
1 parent 73a4a6c commit adb03c0

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
@@ -781,14 +781,12 @@ private function renderBranchStructure(FileNode $node): string
781781

782782
ksort($coverageData);
783783

784+
/** @var ProcessedFunctionCoverageData $methodData */
784785
foreach ($coverageData as $methodName => $methodData) {
785-
if (!$methodData['branches']) {
786-
continue;
787-
}
788-
789786
$branchStructure = '';
790787

791-
foreach ($methodData['branches'] as $branch) {
788+
/** @var ProcessedBranchCoverageData $branch */
789+
foreach ($methodData->branches as $branch) {
792790
$branchStructure .= $this->renderBranchLines($branch, $codeLines, $testData);
793791
}
794792

@@ -806,14 +804,14 @@ private function renderBranchStructure(FileNode $node): string
806804
/**
807805
* @param list<string> $codeLines
808806
*/
809-
private function renderBranchLines(array $branch, array $codeLines, array $testData): string
807+
private function renderBranchLines(ProcessedBranchCoverageData $branch, array $codeLines, array $testData): string
810808
{
811809
$linesTemplate = new Template($this->templatePath . 'lines.html.dist', '{{', '}}');
812810
$singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}');
813811

814812
$lines = '';
815813

816-
$branchLines = range($branch['line_start'], $branch['line_end']);
814+
$branchLines = range($branch->line_start, $branch->line_end);
817815
sort($branchLines); // sometimes end_line < start_line
818816

819817
/** @var int $line */
@@ -825,7 +823,7 @@ private function renderBranchLines(array $branch, array $codeLines, array $testD
825823
$popoverContent = '';
826824
$popoverTitle = '';
827825

828-
$numTests = count($branch['hit']);
826+
$numTests = count($branch->hit);
829827

830828
if ($numTests === 0) {
831829
$trClass = 'danger';
@@ -839,7 +837,7 @@ private function renderBranchLines(array $branch, array $codeLines, array $testD
839837
$popoverTitle = '1 test covers this branch';
840838
}
841839

842-
foreach ($branch['hit'] as $test) {
840+
foreach ($branch->hit as $test) {
843841
if ($lineCss === 'covered-by-large-tests' && $testData[$test]['size'] === 'medium') {
844842
$lineCss = 'covered-by-medium-tests';
845843
} elseif ($testData[$test]['size'] === 'small') {

0 commit comments

Comments
 (0)