Laragear/WebAuthn

[3.x] Add support for CarbonImmutable

saineshmamgain opened this issue · 0 comments

Please check these requirements

  • This feature helps everyone using this package
  • It's feasible and maintainable
  • It's non breaking
  • I issued a PR with the implementation (optional)

Description

Currently the method expiresAt of class Laragear\WebAuthn\Challenge\Challenge expects the return type to be Carbon. And since it uses Date facade by default it will return Carbon only. But for projects where Date facade uses CarbonImmutable handler using Date::use(CarbonImmutable::class); this method will break as the return value from Date facade will be an instance of CarbonImmutable. We can add the return type of expiresAt as CarbonInterface to support both Carbon and CarbonImmutable.

Feel free to close this issue if it is of not that importance.

Code sample

use Carbon\CarbonInterface;

public function expiresAt(): CarbonInterface
{
    return Date::createFromTimestamp($this->expiresAt);
}