Skip to content

Commit

Permalink
Allow carbon ^3
Browse files Browse the repository at this point in the history
Adjust getMinutesUntilExpired() to be compatible with existing behavior.

Before carbon^3, the result was a rounded integer. With carbon^3, the
result was:
- negative (-2....)
- a decimal (.9....)

Rounding and adding the second `true` parameter keeps in BC.
  • Loading branch information
mfn committed Mar 17, 2024
1 parent 3f0fda2 commit ae04793
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"illuminate/support": "^6|^7|^8.67|^9|^10|^11",
"lcobucci/jwt": "^4.0",
"namshi/jose": "^7.0",
"nesbot/carbon": "^2.0"
"nesbot/carbon": "^2.0|^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3",
Expand Down
2 changes: 1 addition & 1 deletion src/Blacklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function getMinutesUntilExpired(Payload $payload)
// get the latter of the two expiration dates and find
// the number of minutes until the expiration date,
// plus 1 minute to avoid overlap
return $exp->max($iat->addMinutes($this->refreshTTL))->addMinute()->diffInRealMinutes();
return round($exp->max($iat->addMinutes($this->refreshTTL))->addMinute()->diffInRealMinutes(null, true));
}

/**
Expand Down

0 comments on commit ae04793

Please sign in to comment.