Skip to content

Commit

Permalink
Using DateTimeInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Sep 11, 2016
1 parent 3756deb commit 3f2c89e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/DateTimeAccessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
class DateTimeAccessor
{
/**
* @var \DateTime
* @var \DateTimeInterface
*/
private $datetime;

/**
* @param \DateTime $datetime
* @param \DateTimeInterface $datetime
*/
public function __construct(\DateTime $datetime)
public function __construct(\DateTimeInterface $datetime)
{
$this->datetime = $datetime;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/DateTimeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function __invoke($datetime, $pattern_or_width_or_skeleton)
* echo $datetime_formatter($datetime, ':Ehm'); // Sat 10:23 PM
* </pre>
*
* @param \DateTime|string|int $datetime The datetime to format.
* @param \DateTimeInterface|string|int $datetime The datetime to format.
* @param string $pattern_or_width_or_skeleton The datetime can be formatted using a pattern,
* a width or a skeleton. The following width are defined: "full", "long", "medium" and "short".
* To format the datetime using a so-called "skeleton", the skeleton identifier must be
Expand Down
8 changes: 4 additions & 4 deletions lib/Territory.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function lazy_get_currency()
/**
* Return the currency used in the territory at a point in time.
*
* @param \DateTime|mixed $date
* @param \DateTimeInterface|mixed $date
*
* @return Currency
*/
Expand Down Expand Up @@ -290,13 +290,13 @@ public function localize($locale_code)
}

/**
* @param \DateTime|string $datetime
* @param \DateTimeInterface|string $datetime
*
* @return \DateTime
* @return \DateTimeInterface
*/
private function ensure_is_datetime($datetime)
{
return $datetime instanceof \DateTime
return $datetime instanceof \DateTimeInterface
? $datetime
: new \DateTime($datetime);
}
Expand Down

0 comments on commit 3f2c89e

Please sign in to comment.