function ProcessedCodeCoverageData::initPreviouslySeenFunction
For a function we have seen before, only copy over and init the 'hit' array for any unseen branches and paths. Techniques such as mocking and where the contents of a file are different vary during tests (e.g. compiling containers) mean that the functions inside a file cannot be relied upon to be static.
@psalm-param XdebugFunctionCoverageType $functionData
2 calls to ProcessedCodeCoverageData::initPreviouslySeenFunction()
- ProcessedCodeCoverageData::initializeUnseenData in vendor/
phpunit/ php-code-coverage/ src/ Data/ ProcessedCodeCoverageData.php - ProcessedCodeCoverageData::merge in vendor/
phpunit/ php-code-coverage/ src/ Data/ ProcessedCodeCoverageData.php
File
-
vendor/
phpunit/ php-code-coverage/ src/ Data/ ProcessedCodeCoverageData.php, line 262
Class
- ProcessedCodeCoverageData
- @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
Namespace
SebastianBergmann\CodeCoverage\DataCode
private function initPreviouslySeenFunction(string $file, string $functionName, array $functionData) : void {
foreach ($functionData['branches'] as $branchId => $branchData) {
if (!isset($this->functionCoverage[$file][$functionName]['branches'][$branchId])) {
$this->functionCoverage[$file][$functionName]['branches'][$branchId] = $branchData;
$this->functionCoverage[$file][$functionName]['branches'][$branchId]['hit'] = [];
}
}
foreach ($functionData['paths'] as $pathId => $pathData) {
if (!isset($this->functionCoverage[$file][$functionName]['paths'][$pathId])) {
$this->functionCoverage[$file][$functionName]['paths'][$pathId] = $pathData;
$this->functionCoverage[$file][$functionName]['paths'][$pathId]['hit'] = [];
}
}
}