Skip to content

Commit

Permalink
Narrow types
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 10, 2024
1 parent bcd0be2 commit 5e5e8cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Data/ProcessedCodeCoverageData.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ public function merge(self $newData): void
* 4 = the line has been tested
*
* During a merge, a higher number is better.
*
* @return 1|2|3|4
*/
private function priorityForLine(array $data, int $line): int
{
Expand Down
10 changes: 10 additions & 0 deletions src/Node/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use function array_filter;
use function count;
use function range;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\StaticAnalysis\Class_;
use SebastianBergmann\CodeCoverage\StaticAnalysis\FileAnalyser;
use SebastianBergmann\CodeCoverage\StaticAnalysis\Function_;
Expand All @@ -22,6 +23,7 @@
/**
* @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
*
* @phpstan-import-type TestType from CodeCoverage
* @phpstan-import-type LinesType from FileAnalyser
*
* @phpstan-type ProcessedFunctionType array{
Expand Down Expand Up @@ -98,6 +100,10 @@ final class File extends AbstractNode
*/
private array $lineCoverageData;
private array $functionCoverageData;

/**
* @var array<string, TestType>
*/
private readonly array $testData;
private int $numExecutableLines = 0;
private int $numExecutedLines = 0;
Expand Down Expand Up @@ -136,6 +142,7 @@ final class File extends AbstractNode

/**
* @param array<int, ?list<non-empty-string>> $lineCoverageData
* @param array<string, TestType> $testData
* @param array<string, Class_> $classes
* @param array<string, Trait_> $traits
* @param array<string, Function_> $functions
Expand Down Expand Up @@ -170,6 +177,9 @@ public function functionCoverageData(): array
return $this->functionCoverageData;
}

/**
* @return array<string, TestType>
*/
public function testData(): array
{
return $this->testData;
Expand Down

0 comments on commit 5e5e8cb

Please sign in to comment.