Skip to content
Permalink
Browse files

Fix division by zero bug with --stats

Fixes #1552
  • Loading branch information...
muglug committed Apr 13, 2019
1 parent 8dda8a0 commit f3b605e442d51d8857983f92a67d91660662ee46
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/Psalm/Internal/Codebase/Analyzer.php
@@ -731,9 +731,12 @@ public function getNonMixedStats()
foreach ($all_deep_scanned_files as $file_path => $_) {
if (isset($this->mixed_counts[$file_path])) {
list($path_mixed_count, $path_nonmixed_count) = $this->mixed_counts[$file_path];
$stats .= number_format(100 * $path_nonmixed_count / ($path_mixed_count + $path_nonmixed_count), 0)
. '% ' . $this->config->shortenFileName($file_path)
. ' (' . $path_mixed_count . ' mixed)' . "\n";
if ($path_mixed_count + $path_nonmixed_count) {
$stats .= number_format(100 * $path_nonmixed_count / ($path_mixed_count + $path_nonmixed_count), 0)
. '% ' . $this->config->shortenFileName($file_path)
. ' (' . $path_mixed_count . ' mixed)' . "\n";
}
}
}

0 comments on commit f3b605e

Please sign in to comment.
You can’t perform that action at this time.