cleanup DateTime handline

* DateTime -> DateTimeImmutable
* DateTime::format('U') -> DateTime::getTimestamp()
* (new DateTime())->getTimestamp() -> time()
This commit is contained in:
Marc Bennewitz
2018-11-08 10:41:01 +01:00
parent fe421878e6
commit 16f9de86f2
24 changed files with 202 additions and 177 deletions

View File

@@ -9,6 +9,8 @@
namespace League\OAuth2\Server\Entities;
use DateTimeImmutable;
interface TokenInterface
{
/**
@@ -28,16 +30,16 @@ interface TokenInterface
/**
* Get the token's expiry date time.
*
* @return \DateTime
* @return DateTimeImmutable
*/
public function getExpiryDateTime();
public function getExpiryDateTime(): DateTimeImmutable;
/**
* Set the date time when the token expires.
*
* @param \DateTime $dateTime
* @param DateTimeImmutable $dateTime
*/
public function setExpiryDateTime(\DateTime $dateTime);
public function setExpiryDateTime(DateTimeImmutable $dateTime);
/**
* Set the identifier of the user associated with the token.