Skip to content

Commit

Permalink
Fix wrong type in ProcessedCodeCoverageData
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 9, 2024
1 parent 48b98da commit bdce6e7
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/Data/ProcessedCodeCoverageData.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@
* @phpstan-import-type XdebugFunctionCoverageType from XdebugDriver
*
* @phpstan-type TestIdType = string
*
* @phpstan-type FunctionCoverageDataType array{
* branches: array<int, array{
* op_start: int,
* op_end: int,
* line_start: int,
* line_end: int,
* hit: list<TestIdType>,
* out: array<int, int>,
* out_hit: array<int, int>,
* }>,
* paths: array<int, array{
* path: array<int, int>,
* hit: list<TestIdType>,
* }>,
* hit: list<TestIdType>
* }
*
* @phpstan-type FunctionCoverageType array<string, array<string, FunctionCoverageDataType>>
*/
final class ProcessedCodeCoverageData
{
Expand All @@ -41,22 +60,7 @@ final class ProcessedCodeCoverageData
* Maintains base format of raw data (@see https://xdebug.org/docs/code_coverage), but each 'hit' entry is an array
* of testcase ids.
*
* @var array<string, array<string, array{
* branches: array<int, array{
* op_start: int,
* op_end: int,
* line_start: int,
* line_end: int,
* hit: list<TestIdType>,
* out: array<int, int>,
* out_hit: array<int, int>,
* }>,
* paths: array<int, array{
* path: array<int, int>,
* hit: list<TestIdType>,
* }>,
* hit: list<TestIdType>
* }>>
* @var FunctionCoverageType
*/
private array $functionCoverage = [];

Expand Down Expand Up @@ -238,7 +242,7 @@ private function priorityForLine(array $data, int $line): int
/**
* For a function we have never seen before, copy all data over and simply init the 'hit' array.
*
* @param XdebugFunctionCoverageType $functionData
* @param XdebugFunctionCoverageType|FunctionCoverageDataType $functionData
*/
private function initPreviouslyUnseenFunction(string $file, string $functionName, array $functionData): void
{
Expand All @@ -258,7 +262,7 @@ private function initPreviouslyUnseenFunction(string $file, string $functionName
* 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.
*
* @param XdebugFunctionCoverageType $functionData
* @param XdebugFunctionCoverageType|FunctionCoverageDataType $functionData
*/
private function initPreviouslySeenFunction(string $file, string $functionName, array $functionData): void
{
Expand Down

0 comments on commit bdce6e7

Please sign in to comment.