Skip to content

Commit

Permalink
Allow DateTimeInterface in executeSet (tedious#341)
Browse files Browse the repository at this point in the history
When `$time`  is not `\DateTime` but implements `\DateTimeInterface` it is ignored and `self::$cacheTime` is used.
  • Loading branch information
thesebas authored and alexbowers committed Mar 14, 2017
1 parent 1d821e6 commit 69313c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Stash/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 69313c9

Please sign in to comment.