25
25
* @phpstan-import-type XdebugFunctionCoverageType from XdebugDriver
26
26
*
27
27
* @phpstan-type TestIdType = string
28
+ *
29
+ * @phpstan-type FunctionCoverageDataType array{
30
+ * branches: array<int, array{
31
+ * op_start: int,
32
+ * op_end: int,
33
+ * line_start: int,
34
+ * line_end: int,
35
+ * hit: list<TestIdType>,
36
+ * out: array<int, int>,
37
+ * out_hit: array<int, int>,
38
+ * }>,
39
+ * paths: array<int, array{
40
+ * path: array<int, int>,
41
+ * hit: list<TestIdType>,
42
+ * }>,
43
+ * hit: list<TestIdType>
44
+ * }
45
+ *
46
+ * @phpstan-type FunctionCoverageType array<string, array<string, FunctionCoverageDataType>>
28
47
*/
29
48
final class ProcessedCodeCoverageData
30
49
{
@@ -41,22 +60,7 @@ final class ProcessedCodeCoverageData
41
60
* Maintains base format of raw data (@see https://xdebug.org/docs/code_coverage), but each 'hit' entry is an array
42
61
* of testcase ids.
43
62
*
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
- * }>>
63
+ * @var FunctionCoverageType
60
64
*/
61
65
private array $ functionCoverage = [];
62
66
@@ -238,7 +242,7 @@ private function priorityForLine(array $data, int $line): int
238
242
/**
239
243
* For a function we have never seen before, copy all data over and simply init the 'hit' array.
240
244
*
241
- * @param XdebugFunctionCoverageType $functionData
245
+ * @param XdebugFunctionCoverageType|FunctionCoverageDataType $functionData
242
246
*/
243
247
private function initPreviouslyUnseenFunction (string $ file , string $ functionName , array $ functionData ): void
244
248
{
@@ -258,7 +262,7 @@ private function initPreviouslyUnseenFunction(string $file, string $functionName
258
262
* Techniques such as mocking and where the contents of a file are different vary during tests (e.g. compiling
259
263
* containers) mean that the functions inside a file cannot be relied upon to be static.
260
264
*
261
- * @param XdebugFunctionCoverageType $functionData
265
+ * @param XdebugFunctionCoverageType|FunctionCoverageDataType $functionData
262
266
*/
263
267
private function initPreviouslySeenFunction (string $ file , string $ functionName , array $ functionData ): void
264
268
{
0 commit comments