Skip to content

Commit

Permalink
Change getDateTime to DateTimeInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Barrero committed Sep 25, 2018
1 parent cc1b86c commit 489b135
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 62 deletions.
2 changes: 1 addition & 1 deletion src/DegradedUuid.php
Expand Up @@ -36,7 +36,7 @@ public function getDateTime()
$time = $this->numberConverter->fromHex($this->getTimestampHex());
$unixTime = $this->timeConverter->convertTime($time);

return new \DateTime("@{$unixTime}");
return new \DateTimeImmutable("@{$unixTime}");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Uuid.php
Expand Up @@ -351,7 +351,7 @@ public function getDateTime()

$unixTime = $this->timeConverter->convertTime($this->getTimestamp());

return new \DateTime("@{$unixTime}");
return new \DateTimeImmutable("@{$unixTime}");
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/UuidInterface.php
Expand Up @@ -118,14 +118,14 @@ public function getClockSeqLowHex();
public function getClockSequenceHex();

/**
* Returns a PHP `DateTime` object representing the timestamp associated
* Returns a PHP object that implements `DateTimeInterface` representing the timestamp associated
* with this UUID.
*
* The timestamp value is only meaningful in a time-based UUID, which
* has version type 1. If this UUID is not a time-based UUID then
* this method throws `UnsupportedOperationException`.
*
* @return DateTime A PHP DateTime representation of the date
* @return \DateTimeInterface A PHP DateTimeImmutable representation of the date
* @throws UnsupportedOperationException If this UUID is not a version 1 UUID
* @throws UnsatisfiedDependencyException if called in a 32-bit system and
* `Moontoast\Math\BigNumber` is not present
Expand Down

0 comments on commit 489b135

Please sign in to comment.