15
15
use function array_keys ;
16
16
use function array_merge ;
17
17
use function array_unique ;
18
- use function array_values ;
19
18
use function count ;
20
19
use function explode ;
21
20
use function is_array ;
@@ -517,23 +516,23 @@ private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed):
517
516
private function processUnintentionallyCoveredUnits (array $ unintentionallyCoveredUnits ): array
518
517
{
519
518
$ unintentionallyCoveredUnits = array_unique ($ unintentionallyCoveredUnits );
520
- sort ( $ unintentionallyCoveredUnits ) ;
519
+ $ processed = [] ;
521
520
522
- foreach (array_keys ($ unintentionallyCoveredUnits ) as $ k => $ v ) {
523
- $ unit = explode (':: ' , $ unintentionallyCoveredUnits [$ k ]);
521
+ foreach ($ unintentionallyCoveredUnits as $ unintentionallyCoveredUnit ) {
522
+ $ tmp = explode (':: ' , $ unintentionallyCoveredUnit );
523
+
524
+ if (count ($ tmp ) !== 2 ) {
525
+ $ processed [] = $ unintentionallyCoveredUnit ;
524
526
525
- if (count ($ unit ) !== 2 ) {
526
527
continue ;
527
528
}
528
529
529
530
try {
530
- $ class = new ReflectionClass ($ unit [0 ]);
531
+ $ class = new ReflectionClass ($ tmp [0 ]);
531
532
532
533
foreach ($ this ->parentClassesExcludedFromUnintentionallyCoveredCodeCheck as $ parentClass ) {
533
534
if ($ class ->isSubclassOf ($ parentClass )) {
534
- unset($ unintentionallyCoveredUnits [$ k ]);
535
-
536
- break ;
535
+ continue 2 ;
537
536
}
538
537
}
539
538
} catch (\ReflectionException $ e ) {
@@ -543,9 +542,15 @@ private function processUnintentionallyCoveredUnits(array $unintentionallyCovere
543
542
$ e
544
543
);
545
544
}
545
+
546
+ $ processed [] = $ tmp [0 ];
546
547
}
547
548
548
- return array_values ($ unintentionallyCoveredUnits );
549
+ $ processed = array_unique ($ processed );
550
+
551
+ sort ($ processed );
552
+
553
+ return $ processed ;
549
554
}
550
555
551
556
private function analyser (): FileAnalyser
0 commit comments