Skip to content

Commit 326f770

Browse files
Fix the count of statements
1 parent 1a60bae commit 326f770

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Lib/IO/MetricsFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static function getFileMetrics(DOMDocument $document): array
7575
$filename = str_replace('\\', '/', (string)XMLUtil::getAttribute($parentNode, 'name'));
7676

7777
// calculate coverage
78-
$statements = (int)XMLUtil::getAttribute($domMetric, 'statements');
78+
$statements = count($xpath->query('line[@type="stmt"]', $parentNode));
7979
$coveredStatements = (int)XMLUtil::getAttribute($domMetric, 'coveredstatements');
8080
$coveragePercentage = $statements === 0 ? 100 : round($coveredStatements / $statements * 100, self::COVERAGE_PERCENTAGE_PRECISION);
8181

0 commit comments

Comments
 (0)