@@ -617,6 +617,17 @@ private function initializeFilesThatAreSeenTheFirstTime(array $data)
617
617
618
618
$ this ->data [$ file ] = ['lines ' => []];
619
619
620
+ foreach ($ fileData ['lines ' ] as $ lineNumber => $ flag ) {
621
+ if ($ flag === PHP_CodeCoverage_Driver::LINE_NOT_EXECUTABLE ) {
622
+ $ this ->data [$ file ]['lines ' ][$ lineNumber ] = null ;
623
+ } else {
624
+ $ this ->data [$ file ]['lines ' ][$ lineNumber ] = [
625
+ 'pathCovered ' => false ,
626
+ 'tests ' => [],
627
+ ];
628
+ }
629
+ }
630
+
620
631
if ($ this ->pathCoverage ) {
621
632
$ this ->data [$ file ]['branches ' ] = [];
622
633
$ this ->data [$ file ]['paths ' ] = [];
@@ -632,34 +643,19 @@ private function initializeFilesThatAreSeenTheFirstTime(array $data)
632
643
'line_end ' => $ branch ['line_end ' ],
633
644
'tests ' => []
634
645
];
646
+
647
+ for ($ i = $ branch ['line_start ' ]; $ i < $ branch ['line_end ' ]; $ i ++) {
648
+ if (isset ($ this ->data [$ file ]['lines ' ][$ i ])) {
649
+ $ this ->data [$ file ]['lines ' ][$ i ]['pathCovered ' ] = (bool ) $ branch ['hit ' ];
650
+ }
651
+ }
635
652
}
636
653
637
654
foreach ($ functionData ['paths ' ] as $ path ) {
638
655
$ this ->data [$ file ]['paths ' ][$ functionName ][] = $ path ;
639
656
}
640
657
}
641
658
}
642
-
643
- foreach ($ fileData ['lines ' ] as $ lineNumber => $ flag ) {
644
- if ($ flag === PHP_CodeCoverage_Driver::LINE_NOT_EXECUTABLE ) {
645
- $ this ->data [$ file ]['lines ' ][$ lineNumber ] = null ;
646
- } else {
647
- $ this ->data [$ file ]['lines ' ][$ lineNumber ] = [
648
- 'pathCovered ' => false ,
649
- 'tests ' => [],
650
- ];
651
- }
652
- }
653
-
654
- foreach ($ this ->data [$ file ]['branches ' ] as $ function ) {
655
- foreach ($ function as $ branch ) {
656
- for ($ i = $ branch ['line_start ' ]; $ i < $ branch ['line_end ' ]; $ i ++) {
657
- if (isset ($ this ->data [$ file ]['lines ' ][$ i ])) {
658
- $ this ->data [$ file ]['lines ' ][$ i ]['pathCovered ' ] = (bool ) $ branch ['hit ' ];
659
- }
660
- }
661
- }
662
- }
663
659
}
664
660
}
665
661
0 commit comments