diff --git a/src/CodeCloneMap.php b/src/CodeCloneMap.php index 54516f4..69057cf 100644 --- a/src/CodeCloneMap.php +++ b/src/CodeCloneMap.php @@ -124,7 +124,13 @@ public function isEmpty(): bool public function averageSize(): float { - return $this->numberOfDuplicatedLines() / $this->count(); + $count = $this->count(); + + if ($count === 0) { + return 0.0; + } + + return $this->numberOfDuplicatedLines() / $count; } public function largestSize(): int