Skip to content

Commit bdce6e7

Browse files
committed
Fix wrong type in ProcessedCodeCoverageData
1 parent 48b98da commit bdce6e7

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

src/Data/ProcessedCodeCoverageData.php

+22-18
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@
2525
* @phpstan-import-type XdebugFunctionCoverageType from XdebugDriver
2626
*
2727
* @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>>
2847
*/
2948
final class ProcessedCodeCoverageData
3049
{
@@ -41,22 +60,7 @@ final class ProcessedCodeCoverageData
4160
* Maintains base format of raw data (@see https://xdebug.org/docs/code_coverage), but each 'hit' entry is an array
4261
* of testcase ids.
4362
*
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
6064
*/
6165
private array $functionCoverage = [];
6266

@@ -238,7 +242,7 @@ private function priorityForLine(array $data, int $line): int
238242
/**
239243
* For a function we have never seen before, copy all data over and simply init the 'hit' array.
240244
*
241-
* @param XdebugFunctionCoverageType $functionData
245+
* @param XdebugFunctionCoverageType|FunctionCoverageDataType $functionData
242246
*/
243247
private function initPreviouslyUnseenFunction(string $file, string $functionName, array $functionData): void
244248
{
@@ -258,7 +262,7 @@ private function initPreviouslyUnseenFunction(string $file, string $functionName
258262
* Techniques such as mocking and where the contents of a file are different vary during tests (e.g. compiling
259263
* containers) mean that the functions inside a file cannot be relied upon to be static.
260264
*
261-
* @param XdebugFunctionCoverageType $functionData
265+
* @param XdebugFunctionCoverageType|FunctionCoverageDataType $functionData
262266
*/
263267
private function initPreviouslySeenFunction(string $file, string $functionName, array $functionData): void
264268
{

0 commit comments

Comments
 (0)