1515use function array_keys ;
1616use function array_merge ;
1717use function array_unique ;
18- use function array_values ;
1918use function count ;
2019use function explode ;
2120use function is_array ;
@@ -517,23 +516,23 @@ private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed):
517516 private function processUnintentionallyCoveredUnits (array $ unintentionallyCoveredUnits ): array
518517 {
519518 $ unintentionallyCoveredUnits = array_unique ($ unintentionallyCoveredUnits );
520- sort ( $ unintentionallyCoveredUnits ) ;
519+ $ processed = [] ;
521520
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 ;
524526
525- if (count ($ unit ) !== 2 ) {
526527 continue ;
527528 }
528529
529530 try {
530- $ class = new ReflectionClass ($ unit [0 ]);
531+ $ class = new ReflectionClass ($ tmp [0 ]);
531532
532533 foreach ($ this ->parentClassesExcludedFromUnintentionallyCoveredCodeCheck as $ parentClass ) {
533534 if ($ class ->isSubclassOf ($ parentClass )) {
534- unset($ unintentionallyCoveredUnits [$ k ]);
535-
536- break ;
535+ continue 2 ;
537536 }
538537 }
539538 } catch (\ReflectionException $ e ) {
@@ -543,9 +542,15 @@ private function processUnintentionallyCoveredUnits(array $unintentionallyCovere
543542 $ e
544543 );
545544 }
545+
546+ $ processed [] = $ tmp [0 ];
546547 }
547548
548- return array_values ($ unintentionallyCoveredUnits );
549+ $ processed = array_unique ($ processed );
550+
551+ sort ($ processed );
552+
553+ return $ processed ;
549554 }
550555
551556 private function analyser (): FileAnalyser
0 commit comments