1414use function array_flip ;
1515use function array_keys ;
1616use function array_merge ;
17- use function array_merge_recursive ;
1817use function array_unique ;
1918use function count ;
2019use function explode ;
@@ -56,11 +55,6 @@ final class CodeCoverage
5655 private ProcessedCodeCoverageData $ data ;
5756 private bool $ useAnnotationsForIgnoringCode = true ;
5857
59- /**
60- * @var array<string,list<int>>
61- */
62- private array $ linesToBeIgnored = [];
63-
6458 /**
6559 * @var array<string, TestType>
6660 */
@@ -174,19 +168,11 @@ public function start(string $id, ?TestSize $size = null, bool $clear = false):
174168 $ this ->cachedReport = null ;
175169 }
176170
177- /**
178- * @param array<string,list<int>> $linesToBeIgnored
179- */
180- public function stop (bool $ append = true , ?TestStatus $ status = null , array |false $ linesToBeCovered = [], array $ linesToBeUsed = [], array $ linesToBeIgnored = []): RawCodeCoverageData
171+ public function stop (bool $ append = true , ?TestStatus $ status = null , array |false $ linesToBeCovered = [], array $ linesToBeUsed = []): RawCodeCoverageData
181172 {
182173 $ data = $ this ->driver ->stop ();
183174
184- $ this ->linesToBeIgnored = array_merge_recursive (
185- $ this ->linesToBeIgnored ,
186- $ linesToBeIgnored ,
187- );
188-
189- $ this ->append ($ data , null , $ append , $ status , $ linesToBeCovered , $ linesToBeUsed , $ linesToBeIgnored );
175+ $ this ->append ($ data , null , $ append , $ status , $ linesToBeCovered , $ linesToBeUsed );
190176
191177 $ this ->currentId = null ;
192178 $ this ->currentSize = null ;
@@ -196,13 +182,11 @@ public function stop(bool $append = true, ?TestStatus $status = null, array|fals
196182 }
197183
198184 /**
199- * @param array<string,list<int>> $linesToBeIgnored
200- *
201185 * @throws ReflectionException
202186 * @throws TestIdMissingException
203187 * @throws UnintentionallyCoveredCodeException
204188 */
205- public function append (RawCodeCoverageData $ rawData , ?string $ id = null , bool $ append = true , ?TestStatus $ status = null , array |false $ linesToBeCovered = [], array $ linesToBeUsed = [], array $ linesToBeIgnored = [] ): void
189+ public function append (RawCodeCoverageData $ rawData , ?string $ id = null , bool $ append = true , ?TestStatus $ status = null , array |false $ linesToBeCovered = [], array $ linesToBeUsed = []): void
206190 {
207191 if ($ id === null ) {
208192 $ id = $ this ->currentId ;
@@ -229,7 +213,7 @@ public function append(RawCodeCoverageData $rawData, ?string $id = null, bool $a
229213 $ this ->applyExecutableLinesFilter ($ rawData );
230214
231215 if ($ this ->useAnnotationsForIgnoringCode ) {
232- $ this ->applyIgnoredLinesFilter ($ rawData, $ linesToBeIgnored );
216+ $ this ->applyIgnoredLinesFilter ($ rawData );
233217 }
234218
235219 $ this ->data ->initializeUnseenData ($ rawData );
@@ -452,23 +436,13 @@ private function applyExecutableLinesFilter(RawCodeCoverageData $data): void
452436 }
453437 }
454438
455- /**
456- * @param array<string,list<int>> $linesToBeIgnored
457- */
458- private function applyIgnoredLinesFilter (RawCodeCoverageData $ data , array $ linesToBeIgnored ): void
439+ private function applyIgnoredLinesFilter (RawCodeCoverageData $ data ): void
459440 {
460441 foreach (array_keys ($ data ->lineCoverage ()) as $ filename ) {
461442 if (!$ this ->filter ->isFile ($ filename )) {
462443 continue ;
463444 }
464445
465- if (isset ($ linesToBeIgnored [$ filename ])) {
466- $ data ->removeCoverageDataForLines (
467- $ filename ,
468- $ linesToBeIgnored [$ filename ],
469- );
470- }
471-
472446 $ data ->removeCoverageDataForLines (
473447 $ filename ,
474448 $ this ->analyser ()->ignoredLinesFor ($ filename ),
@@ -494,7 +468,6 @@ private function addUncoveredFilesFromFilter(): void
494468 $ this ->analyser (),
495469 ),
496470 self ::UNCOVERED_FILES ,
497- linesToBeIgnored: $ this ->linesToBeIgnored ,
498471 );
499472 }
500473 }
0 commit comments