From 69313c9249bd13b8e0fdde0e7f34b977dc4fe6aa Mon Sep 17 00:00:00 2001 From: Sebastian Szymbor Date: Tue, 14 Mar 2017 11:22:01 +0100 Subject: [PATCH] Allow DateTimeInterface in `executeSet` (#341) When `$time` is not `\DateTime` but implements `\DateTimeInterface` it is ignored and `self::$cacheTime` is used. --- src/Stash/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stash/Item.php b/src/Stash/Item.php index 2a3aca2e..36700cd4 100644 --- a/src/Stash/Item.php +++ b/src/Stash/Item.php @@ -422,7 +422,7 @@ private function executeSet($data, $time) $store['return'] = $data; $store['createdOn'] = time(); - if (isset($time) && ($time instanceof \DateTime)) { + if (isset($time) && (($time instanceof \DateTime) || ($time instanceof \DateTimeInterface))) { $expiration = $time->getTimestamp(); $cacheTime = $expiration - $store['createdOn']; } else {