function RawCodeCoverageData::getEmptyLinesForFile
1 call to RawCodeCoverageData::getEmptyLinesForFile()
- RawCodeCoverageData::skipEmptyLines in vendor/
phpunit/ php-code-coverage/ src/ Data/ RawCodeCoverageData.php - 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…
File
-
vendor/
phpunit/ php-code-coverage/ src/ Data/ RawCodeCoverageData.php, line 263
Class
- RawCodeCoverageData
- @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
Namespace
SebastianBergmann\CodeCoverage\DataCode
private function getEmptyLinesForFile(string $filename) : array {
if (!isset(self::$emptyLineCache[$filename])) {
self::$emptyLineCache[$filename] = [];
if (is_file($filename)) {
$sourceLines = explode("\n", file_get_contents($filename));
foreach ($sourceLines as $line => $source) {
if (trim($source) === '') {
self::$emptyLineCache[$filename][] = $line + 1;
}
}
}
}
return self::$emptyLineCache[$filename];
}