2020
2121/**
2222 * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
23+ *
24+ * @psalm-import-type XdebugFunctionCoverageType from \SebastianBergmann\CodeCoverage\Driver\XdebugDriver
25+ *
26+ * @psalm-type TestIdType = string
2327 */
2428final class ProcessedCodeCoverageData
2529{
2630 /**
2731 * Line coverage data.
2832 * An array of filenames, each having an array of linenumbers, each executable line having an array of testcase ids.
33+ *
34+ * @psalm-var array<string, array<int, null|list<TestIdType>>>
2935 */
3036 private array $ lineCoverage = [];
3137
3238 /**
3339 * Function coverage data.
3440 * Maintains base format of raw data (@see https://xdebug.org/docs/code_coverage), but each 'hit' entry is an array
3541 * of testcase ids.
42+ *
43+ * @psalm-var array<string, array<string, array{
44+ * branches: array<int, array{
45+ * op_start: int,
46+ * op_end: int,
47+ * line_start: int,
48+ * line_end: int,
49+ * hit: list<TestIdType>,
50+ * out: array<int, int>,
51+ * out_hit: array<int, int>,
52+ * }>,
53+ * paths: array<int, array{
54+ * path: array<int, int>,
55+ * hit: list<TestIdType>,
56+ * }>,
57+ * hit: list<TestIdType>
58+ * }>>
3659 */
3760 private array $ functionCoverage = [];
3861
@@ -213,6 +236,8 @@ private function priorityForLine(array $data, int $line): int
213236
214237 /**
215238 * For a function we have never seen before, copy all data over and simply init the 'hit' array.
239+ *
240+ * @psalm-param XdebugFunctionCoverageType $functionData
216241 */
217242 private function initPreviouslyUnseenFunction (string $ file , string $ functionName , array $ functionData ): void
218243 {
@@ -231,6 +256,8 @@ private function initPreviouslyUnseenFunction(string $file, string $functionName
231256 * For a function we have seen before, only copy over and init the 'hit' array for any unseen branches and paths.
232257 * Techniques such as mocking and where the contents of a file are different vary during tests (e.g. compiling
233258 * containers) mean that the functions inside a file cannot be relied upon to be static.
259+ *
260+ * @psalm-param XdebugFunctionCoverageType $functionData
234261 */
235262 private function initPreviouslySeenFunction (string $ file , string $ functionName , array $ functionData ): void
236263 {
0 commit comments