1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +01:00

Fix division by zero bug with --stats

Fixes #1552
This commit is contained in:
Matthew Brown 2019-04-13 13:41:39 -04:00
parent 8dda8a0ee4
commit f3b605e442

View File

@ -731,9 +731,12 @@ class Analyzer
foreach ($all_deep_scanned_files as $file_path => $_) { foreach ($all_deep_scanned_files as $file_path => $_) {
if (isset($this->mixed_counts[$file_path])) { if (isset($this->mixed_counts[$file_path])) {
list($path_mixed_count, $path_nonmixed_count) = $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) if ($path_mixed_count + $path_nonmixed_count) {
. ' (' . $path_mixed_count . ' mixed)' . "\n"; $stats .= number_format(100 * $path_nonmixed_count / ($path_mixed_count + $path_nonmixed_count), 0)
. '% ' . $this->config->shortenFileName($file_path)
. ' (' . $path_mixed_count . ' mixed)' . "\n";
}
} }
} }