From e370cf93bfe24d9cce7b7153605842c42b9a0b7c Mon Sep 17 00:00:00 2001 From: smhg Date: Fri, 1 Mar 2019 11:50:01 +0100 Subject: [PATCH] support DateTimeImmutable --- src/Timespan/Timespan.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Timespan/Timespan.php b/src/Timespan/Timespan.php index 43d830c..eae03a5 100644 --- a/src/Timespan/Timespan.php +++ b/src/Timespan/Timespan.php @@ -1,7 +1,7 @@ start = $start; $this->end = $end; @@ -19,10 +19,10 @@ public function __construct(DateTime $start, DateTime $end) /** * Check whether timespan contains a date. * Includes start, excludes end (like PHP's DatePeriod) - * @param DateTime $date + * @param DateTimeInterface $date * @return boolean */ - public function contains(DateTime $date) + public function contains(DateTimeInterface $date) { return $this->start <= $date && $date < $this->end; } @@ -100,11 +100,11 @@ public function merge(Timespan $span) /** * Trim timespan to fit within boundaries - * @param DateTime $start - * @param DateTime $end + * @param DateTimeInterface $start + * @param DateTimeInterface $end * @return Timespan|null A new, trimmed, timespan or `null` if nothing remains */ - public function trim(DateTime $start, DateTime $end) + public function trim(DateTimeInterface $start, DateTimeInterface $end) { $trimmed = clone $this;