PHP-Open-Source-Saver / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
MIT License
729 stars 113 forks source link

Cater for both Carbon v2 and v3 - issue #260 #261

Closed specialtactics closed 4 months ago

specialtactics commented 4 months ago

Carbon v3 deprecates the "diff real" functions, and throws a deprecated. It automatically routes the request to the function it thinks best, which in this case is diffInRealMinutes (see Carbon\Traits\Date::callDiffAlias() for details on why).

Since we are aiming to support both, I split the code into a conditional, calling the appropriate function. It also now returns a float, so it's necessary to cast round result to int - as it too will return a float.

I also added a test pipeline specifically for carbon 3, since nothing requires it specifically right now.

Description

Fixes #260

Checklist: