1515 * @phpstan-import-type TestIdType from ProcessedCodeCoverageData
1616 * @phpstan-import-type XdebugFunctionCoverageType from XdebugDriver
1717 */
18- final class ProcessedFunctionCoverageData {
19- public function __construct (
20- /** @var array<int, ProcessedBranchCoverageData> */
21- public array $ branches ,
22- /** @var array<int, ProcessedPathCoverageData> */
23- public array $ paths ,
24-
25- ) {}
26-
18+ final class ProcessedFunctionCoverageData
19+ {
2720 /**
2821 * @param XdebugFunctionCoverageType $xdebugCoverageData
2922 */
30- static public function fromXdebugCoverage (array $ xdebugCoverageData ): self
23+ public static function fromXdebugCoverage (array $ xdebugCoverageData ): self
3124 {
3225 $ branches = [];
33- foreach ($ xdebugCoverageData ['branches ' ] as $ branchId => $ branch ) {
26+
27+ foreach ($ xdebugCoverageData ['branches ' ] as $ branchId => $ branch ) {
3428 $ branches [$ branchId ] = ProcessedBranchCoverageData::fromXdebugCoverage ($ branch );
3529 }
3630 $ paths = [];
37- foreach ($ xdebugCoverageData ['paths ' ] as $ pathId => $ path ) {
31+
32+ foreach ($ xdebugCoverageData ['paths ' ] as $ pathId => $ path ) {
3833 $ paths [$ pathId ] = ProcessedPathCoverageData::fromXdebugCoverage ($ path );
3934 }
4035
4136 return new self (
4237 $ branches ,
43- $ paths
38+ $ paths,
4439 );
4540 }
4641
42+ public function __construct (
43+ /** @var array<int, ProcessedBranchCoverageData> */
44+ public array $ branches ,
45+ /** @var array<int, ProcessedPathCoverageData> */
46+ public array $ paths ,
47+ ) {
48+ }
49+
4750 public function merge (self $ data ): self
4851 {
4952 $ branches = $ this ->branches ;
50- foreach ($ data ->branches as $ branchId => $ branch ) {
53+
54+ foreach ($ data ->branches as $ branchId => $ branch ) {
5155 if (!isset ($ branches [$ branchId ])) {
5256 $ branches [$ branchId ] = $ branch ;
5357 } else {
@@ -56,7 +60,8 @@ public function merge(self $data): self
5660 }
5761
5862 $ paths = $ this ->paths ;
59- foreach ($ data ->paths as $ pathId => $ path ) {
63+
64+ foreach ($ data ->paths as $ pathId => $ path ) {
6065 if (!isset ($ paths [$ pathId ])) {
6166 $ paths [$ pathId ] = $ path ;
6267 } else {
@@ -66,18 +71,20 @@ public function merge(self $data): self
6671
6772 return new self (
6873 $ branches ,
69- $ paths
74+ $ paths,
7075 );
7176 }
7277
7378 /**
7479 * @param TestIdType $testCaseId
7580 */
76- public function recordBranchHit (int $ branchId , string $ testCaseId ): void {
81+ public function recordBranchHit (int $ branchId , string $ testCaseId ): void
82+ {
7783 $ this ->branches [$ branchId ]->recordHit ($ testCaseId );
7884 }
7985
80- public function recordPathHit (int $ pathId , string $ testCaseId ): void {
86+ public function recordPathHit (int $ pathId , string $ testCaseId ): void
87+ {
8188 $ this ->paths [$ pathId ]->recordHit ($ testCaseId );
8289 }
8390}
0 commit comments