From 16fe0a238889008f4b0d16ca651964558eb7b4f3 Mon Sep 17 00:00:00 2001 From: Tom de Wit Date: Fri, 27 Sep 2019 11:42:22 +0200 Subject: [PATCH] Allow floats to be used for coverage We're playing with "previous coverage" vs. "new coverage" and "previous coverage" echoes floats. --- coverage-check.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coverage-check.php b/coverage-check.php index a4f8aae..f0dc6f9 100755 --- a/coverage-check.php +++ b/coverage-check.php @@ -11,7 +11,7 @@ } $inputFile = $argv[1]; -$percentage = min(100, max(0, (int)$argv[2])); +$percentage = min(100, max(0, (float)$argv[2])); $xml = new SimpleXMLElement(file_get_contents($inputFile)); $metrics = $xml->xpath('//metrics'); @@ -40,4 +40,4 @@ exit(1); } -echo 'Total code coverage is ' . sprintf('%0.2f', $TPC) . '% - OK!' . PHP_EOL; \ No newline at end of file +echo 'Total code coverage is ' . sprintf('%0.2f', $TPC) . '% - OK!' . PHP_EOL;