File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 12
12
use const PHP_EOL ;
13
13
use function is_file ;
14
14
use function printf ;
15
- use SebastianBergmann \CodeCoverage \Percentage ;
16
15
17
16
final class PatchCoverageCommand extends Command
18
17
{
@@ -61,10 +60,10 @@ public function run(Arguments $arguments): int
61
60
'%d / %d changed executable lines covered (%s) ' . PHP_EOL ,
62
61
$ patchCoverage ['numChangedLinesThatWereExecuted ' ],
63
62
$ patchCoverage ['numChangedLinesThatAreExecutable ' ],
64
- Percentage:: fromFractionAndTotal (
63
+ $ this -> percentage (
65
64
$ patchCoverage ['numChangedLinesThatWereExecuted ' ],
66
65
$ patchCoverage ['numChangedLinesThatAreExecutable ' ]
67
- )-> asFixedWidthString ()
66
+ )
68
67
);
69
68
70
69
if (!empty ($ patchCoverage ['changedLinesThatWereNotExecuted ' ])) {
@@ -85,4 +84,13 @@ public function run(Arguments $arguments): int
85
84
86
85
return 0 ;
87
86
}
87
+
88
+ private function percentage (float $ fraction , float $ total ): string
89
+ {
90
+ if ($ total > 0 ) {
91
+ return sprintf ('%6.2F%% ' , ($ fraction / $ total ) * 100 );
92
+ }
93
+
94
+ return '' ;
95
+ }
88
96
}
You can’t perform that action at this time.
0 commit comments