@@ -547,6 +547,11 @@ private function processTraits(array $traits): void
547547 $ this ->traits [$ traitName ]['executablePaths ' ] += $ methodData ['executablePaths ' ];
548548 $ this ->traits [$ traitName ]['executedPaths ' ] += $ methodData ['executedPaths ' ];
549549
550+ $ this ->numExecutableBranches += $ methodData ['executableBranches ' ];
551+ $ this ->numExecutedBranches += $ methodData ['executedBranches ' ];
552+ $ this ->numExecutablePaths += $ methodData ['executablePaths ' ];
553+ $ this ->numExecutedPaths += $ methodData ['executedPaths ' ];
554+
550555 foreach (range ($ method ['startLine ' ], $ method ['endLine ' ]) as $ lineNumber ) {
551556 $ this ->codeUnitsByLine [$ lineNumber ] = [
552557 &$ this ->traits [$ traitName ],
@@ -582,6 +587,25 @@ private function processFunctions(array $functions): void
582587 foreach (range ($ function ['startLine ' ], $ function ['endLine ' ]) as $ lineNumber ) {
583588 $ this ->codeUnitsByLine [$ lineNumber ] = [&$ this ->functions [$ functionName ]];
584589 }
590+
591+ if (isset ($ this ->functionCoverageData [$ functionName ]['branches ' ])) {
592+ $ this ->functions [$ functionName ]['executableBranches ' ] = count ($ this ->functionCoverageData [$ functionName ]['branches ' ]);
593+ $ this ->functions [$ functionName ]['executedBranches ' ] = count (array_filter ($ this ->functionCoverageData [$ functionName ]['branches ' ], static function (array $ branch ) {
594+ return (bool ) $ branch ['hit ' ];
595+ }));
596+ }
597+
598+ if (isset ($ this ->functionCoverageData [$ functionName ]['paths ' ])) {
599+ $ this ->functions [$ functionName ]['executablePaths ' ] = count ($ this ->functionCoverageData [$ functionName ]['paths ' ]);
600+ $ this ->functions [$ functionName ]['executedPaths ' ] = count (array_filter ($ this ->functionCoverageData [$ functionName ]['paths ' ], static function (array $ path ) {
601+ return (bool ) $ path ['hit ' ];
602+ }));
603+ }
604+
605+ $ this ->numExecutableBranches += $ this ->functions [$ functionName ]['executableBranches ' ];
606+ $ this ->numExecutedBranches += $ this ->functions [$ functionName ]['executedBranches ' ];
607+ $ this ->numExecutablePaths += $ this ->functions [$ functionName ]['executablePaths ' ];
608+ $ this ->numExecutedPaths += $ this ->functions [$ functionName ]['executedPaths ' ];
585609 }
586610 }
587611
@@ -609,14 +633,14 @@ private function newMethod(string $className, string $methodName, array $method,
609633
610634 if (isset ($ this ->functionCoverageData [$ key ]['branches ' ])) {
611635 $ methodData ['executableBranches ' ] = count ($ this ->functionCoverageData [$ key ]['branches ' ]);
612- $ methodData ['executedBranches ' ] = count (array_filter ($ this ->functionCoverageData [$ key ]['branches ' ], static function ($ branch ) {
636+ $ methodData ['executedBranches ' ] = count (array_filter ($ this ->functionCoverageData [$ key ]['branches ' ], static function (array $ branch ) {
613637 return (bool ) $ branch ['hit ' ];
614638 }));
615639 }
616640
617641 if (isset ($ this ->functionCoverageData [$ key ]['paths ' ])) {
618642 $ methodData ['executablePaths ' ] = count ($ this ->functionCoverageData [$ key ]['paths ' ]);
619- $ methodData ['executedPaths ' ] = count (array_filter ($ this ->functionCoverageData [$ key ]['paths ' ], static function ($ path ) {
643+ $ methodData ['executedPaths ' ] = count (array_filter ($ this ->functionCoverageData [$ key ]['paths ' ], static function (array $ path ) {
620644 return (bool ) $ path ['hit ' ];
621645 }));
622646 }
0 commit comments