function RawCodeCoverageData::skipEmptyLines
At the end of a file, the PHP interpreter always sees an implicit return. Where this occurs in a file that has e.g. a class definition, that line cannot be invoked from a test and results in confusing coverage. This engine implementation detail therefore needs to be masked which is done here by simply ensuring that all empty lines are skipped over for coverage purposes.
See also
https://github.com/sebastianbergmann/php-code-coverage/issues/799
1 call to RawCodeCoverageData::skipEmptyLines()
- RawCodeCoverageData::__construct in vendor/
phpunit/ php-code-coverage/ src/ Data/ RawCodeCoverageData.php - @psalm-param XdebugCodeCoverageWithoutPathCoverageType $lineCoverage @psalm-param array<string, XdebugFunctionsCoverageType> $functionCoverage
File
-
vendor/
phpunit/ php-code-coverage/ src/ Data/ RawCodeCoverageData.php, line 254
Class
- RawCodeCoverageData
- @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
Namespace
SebastianBergmann\CodeCoverage\DataCode
private function skipEmptyLines() : void {
foreach ($this->lineCoverage as $filename => $coverage) {
foreach ($this->getEmptyLinesForFile($filename) as $emptyLine) {
unset($this->lineCoverage[$filename][$emptyLine]);
}
}
}