14
14
use function array_flip ;
15
15
use function array_keys ;
16
16
use function array_merge ;
17
- use function array_merge_recursive ;
18
17
use function array_unique ;
19
18
use function count ;
20
19
use function explode ;
@@ -56,11 +55,6 @@ final class CodeCoverage
56
55
private ProcessedCodeCoverageData $ data ;
57
56
private bool $ useAnnotationsForIgnoringCode = true ;
58
57
59
- /**
60
- * @var array<string,list<int>>
61
- */
62
- private array $ linesToBeIgnored = [];
63
-
64
58
/**
65
59
* @var array<string, TestType>
66
60
*/
@@ -174,19 +168,11 @@ public function start(string $id, ?TestSize $size = null, bool $clear = false):
174
168
$ this ->cachedReport = null ;
175
169
}
176
170
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
181
172
{
182
173
$ data = $ this ->driver ->stop ();
183
174
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 );
190
176
191
177
$ this ->currentId = null ;
192
178
$ this ->currentSize = null ;
@@ -196,13 +182,11 @@ public function stop(bool $append = true, ?TestStatus $status = null, array|fals
196
182
}
197
183
198
184
/**
199
- * @param array<string,list<int>> $linesToBeIgnored
200
- *
201
185
* @throws ReflectionException
202
186
* @throws TestIdMissingException
203
187
* @throws UnintentionallyCoveredCodeException
204
188
*/
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
206
190
{
207
191
if ($ id === null ) {
208
192
$ id = $ this ->currentId ;
@@ -229,7 +213,7 @@ public function append(RawCodeCoverageData $rawData, ?string $id = null, bool $a
229
213
$ this ->applyExecutableLinesFilter ($ rawData );
230
214
231
215
if ($ this ->useAnnotationsForIgnoringCode ) {
232
- $ this ->applyIgnoredLinesFilter ($ rawData, $ linesToBeIgnored );
216
+ $ this ->applyIgnoredLinesFilter ($ rawData );
233
217
}
234
218
235
219
$ this ->data ->initializeUnseenData ($ rawData );
@@ -452,23 +436,13 @@ private function applyExecutableLinesFilter(RawCodeCoverageData $data): void
452
436
}
453
437
}
454
438
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
459
440
{
460
441
foreach (array_keys ($ data ->lineCoverage ()) as $ filename ) {
461
442
if (!$ this ->filter ->isFile ($ filename )) {
462
443
continue ;
463
444
}
464
445
465
- if (isset ($ linesToBeIgnored [$ filename ])) {
466
- $ data ->removeCoverageDataForLines (
467
- $ filename ,
468
- $ linesToBeIgnored [$ filename ],
469
- );
470
- }
471
-
472
446
$ data ->removeCoverageDataForLines (
473
447
$ filename ,
474
448
$ this ->analyser ()->ignoredLinesFor ($ filename ),
@@ -494,7 +468,6 @@ private function addUncoveredFilesFromFilter(): void
494
468
$ this ->analyser (),
495
469
),
496
470
self ::UNCOVERED_FILES ,
497
- linesToBeIgnored: $ this ->linesToBeIgnored ,
498
471
);
499
472
}
500
473
}
0 commit comments