function RawCodeCoverageData::fromXdebugWithPathCoverage
@psalm-param XdebugCodeCoverageWithPathCoverageType $rawCoverage
1 call to RawCodeCoverageData::fromXdebugWithPathCoverage()
- XdebugDriver::stop in vendor/
phpunit/ php-code-coverage/ src/ Driver/ XdebugDriver.php
File
-
vendor/
phpunit/ php-code-coverage/ src/ Data/ RawCodeCoverageData.php, line 65
Class
- RawCodeCoverageData
- @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
Namespace
SebastianBergmann\CodeCoverage\DataCode
public static function fromXdebugWithPathCoverage(array $rawCoverage) : self {
$lineCoverage = [];
$functionCoverage = [];
foreach ($rawCoverage as $file => $fileCoverageData) {
// Xdebug annotates the function name of traits, strip that off
foreach ($fileCoverageData['functions'] as $existingKey => $data) {
if (str_ends_with($existingKey, '}') && !str_starts_with($existingKey, '{')) {
// don't want to catch {main}
$newKey = preg_replace('/\\{.*}$/', '', $existingKey);
$fileCoverageData['functions'][$newKey] = $data;
unset($fileCoverageData['functions'][$existingKey]);
}
}
$lineCoverage[$file] = $fileCoverageData['lines'];
$functionCoverage[$file] = $fileCoverageData['functions'];
}
return new self($lineCoverage, $functionCoverage);
}