Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong type in ProcessedCodeCoverageData #1052

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions src/Data/ProcessedCodeCoverageData.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@
* @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 +58,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 +240,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 FunctionCoverageDataType|XdebugFunctionCoverageType $functionData
*/
private function initPreviouslyUnseenFunction(string $file, string $functionName, array $functionData): void
{
Expand All @@ -258,7 +260,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 FunctionCoverageDataType|XdebugFunctionCoverageType $functionData
*/
private function initPreviouslySeenFunction(string $file, string $functionName, array $functionData): void
{
Expand Down
Loading