diff --git a/src/PeriodTraits/PeriodOperations.php b/src/PeriodTraits/PeriodOperations.php index 292abad..d7a0aca 100644 --- a/src/PeriodTraits/PeriodOperations.php +++ b/src/PeriodTraits/PeriodOperations.php @@ -38,7 +38,9 @@ public function gap(Period $period): ?static public function overlap(Period ...$others): ?static { - if (count($others) > 1) { + if (count($others) === 0) { + return null; + } else if (count($others) > 1) { return $this->overlapAll(...$others); } else { $other = $others[0]; @@ -115,7 +117,9 @@ public function overlapAny(Period ...$others): PeriodCollection */ public function subtract(Period ...$others): PeriodCollection { - if (count($others) > 1) { + if (count($others) === 0) + return PeriodCollection::make($this); + } else if (count($others) > 1) { return $this->subtractAll(...$others); } else { $other = $others[0];