Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RawCodeCoverageData.php

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\Data

Code

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];
}
RSS feed
Powered by Drupal