1717 * @phpstan-import-type TestIdType from ProcessedCodeCoverageData
1818 * @phpstan-import-type XdebugBranchCoverageType from XdebugDriver
1919 */
20- final readonly class ProcessedBranchCoverageData
20+ final class ProcessedBranchCoverageData
2121{
2222 /**
2323 * @param XdebugBranchCoverageType $xdebugCoverageData
@@ -36,19 +36,20 @@ public static function fromXdebugCoverage(array $xdebugCoverageData): self
3636 }
3737
3838 public function __construct (
39- public int $ op_start ,
40- public int $ op_end ,
41- public int $ line_start ,
42- public int $ line_end ,
39+ readonly public int $ op_start ,
40+ readonly public int $ op_end ,
41+ readonly public int $ line_start ,
42+ readonly public int $ line_end ,
4343 /** @var list<TestIdType> */
4444 public array $ hit ,
4545 /** @var array<int, int> */
46- public array $ out ,
46+ readonly public array $ out ,
4747 /** @var array<int, int> */
48- public array $ out_hit ,
48+ readonly public array $ out_hit ,
4949 ) {
5050 }
5151
52+ #[\NoDiscard]
5253 public function merge (self $ data ): self
5354 {
5455 return new self (
@@ -65,19 +66,8 @@ public function merge(self $data): self
6566 /**
6667 * @param TestIdType $testCaseId
6768 */
68- public function recordHit (string $ testCaseId ): self
69+ public function recordHit (string $ testCaseId ): void
6970 {
70- $ hit = $ this ->hit ;
71- $ hit [] = $ testCaseId ;
72-
73- return new self (
74- $ this ->op_start ,
75- $ this ->op_end ,
76- $ this ->line_start ,
77- $ this ->line_end ,
78- $ hit ,
79- $ this ->out ,
80- $ this ->out_hit ,
81- );
71+ $ this ->hit [] = $ testCaseId ;
8272 }
8373}
0 commit comments