Skip to content

Commit 42381e5

Browse files
authored
fix: Carbon 3 diffInMinutes (#2287)
1 parent 6c98cea commit 42381e5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Blacklist.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,13 @@ protected function getMinutesUntilExpired(Payload $payload)
9797
// get the latter of the two expiration dates and find
9898
// the number of minutes until the expiration date,
9999
// plus 1 minute to avoid overlap
100-
$minutes = $exp->max($iat->addMinutes($this->refreshTTL))->addMinute()->diffInRealMinutes();
100+
$expiration = $exp->max($iat->addMinutes($this->refreshTTL))->addMinute();
101101

102-
// if Carbon 3
103-
if (is_float($minutes)) {
104-
return (int) round(abs($minutes));
105-
}
102+
$minutes = method_exists($expiration, 'diffInRealMinutes')
103+
? $expiration->diffInRealMinutes()
104+
: $expiration->diffInUTCMinutes();
106105

107-
return $minutes;
106+
return (int) ceil(abs($minutes));
108107
}
109108

110109
/**

0 commit comments

Comments
 (0)