2525 * @phpstan-import-type XdebugFunctionCoverageType from XdebugDriver
2626 *
2727 * @phpstan-type TestIdType string
28+ * @phpstan-type FunctionCoverageDataType array{
29+ * branches: array<int, array{
30+ * op_start: int,
31+ * op_end: int,
32+ * line_start: int,
33+ * line_end: int,
34+ * hit: list<TestIdType>,
35+ * out: array<int, int>,
36+ * out_hit: array<int, int>,
37+ * }>,
38+ * paths: array<int, array{
39+ * path: array<int, int>,
40+ * hit: list<TestIdType>,
41+ * }>,
42+ * hit: list<TestIdType>
43+ * }
44+ *
45+ * @phpstan-type FunctionCoverageType array<string, array<string, FunctionCoverageDataType>>
2846 */
2947final class ProcessedCodeCoverageData
3048{
@@ -41,22 +59,7 @@ final class ProcessedCodeCoverageData
4159 * Maintains base format of raw data (@see https://xdebug.org/docs/code_coverage), but each 'hit' entry is an array
4260 * of testcase ids.
4361 *
44- * @var array<string, array<string, array{
45- * branches: array<int, array{
46- * op_start: int,
47- * op_end: int,
48- * line_start: int,
49- * line_end: int,
50- * hit: list<TestIdType>,
51- * out: array<int, int>,
52- * out_hit: array<int, int>,
53- * }>,
54- * paths: array<int, array{
55- * path: array<int, int>,
56- * hit: list<TestIdType>,
57- * }>,
58- * hit: list<TestIdType>
59- * }>>
62+ * @var FunctionCoverageType
6063 */
6164 private array $ functionCoverage = [];
6265
@@ -238,7 +241,7 @@ private function priorityForLine(array $data, int $line): int
238241 /**
239242 * For a function we have never seen before, copy all data over and simply init the 'hit' array.
240243 *
241- * @param XdebugFunctionCoverageType $functionData
244+ * @param XdebugFunctionCoverageType|FunctionCoverageDataType $functionData
242245 */
243246 private function initPreviouslyUnseenFunction (string $ file , string $ functionName , array $ functionData ): void
244247 {
@@ -258,7 +261,7 @@ private function initPreviouslyUnseenFunction(string $file, string $functionName
258261 * Techniques such as mocking and where the contents of a file are different vary during tests (e.g. compiling
259262 * containers) mean that the functions inside a file cannot be relied upon to be static.
260263 *
261- * @param XdebugFunctionCoverageType $functionData
264+ * @param XdebugFunctionCoverageType|FunctionCoverageDataType $functionData
262265 */
263266 private function initPreviouslySeenFunction (string $ file , string $ functionName , array $ functionData ): void
264267 {
0 commit comments