Skip to content

Commit

Permalink
Fix error reported by phpstan in I18n/RelativeTimeFormatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Aug 20, 2017
1 parent 360319a commit 7a01ea4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/I18n/RelativeTimeFormatter.php
Expand Up @@ -37,7 +37,7 @@ public function diffForHumans(ChronosInterface $date, ChronosInterface $other =
{
$isNow = $other === null;
if ($isNow) {
$other = $date->now($date->tz);
$other = $date->now($date->getTimezone());
}
$diffInterval = $date->diff($other);

Expand Down Expand Up @@ -94,7 +94,7 @@ public function diffForHumans(ChronosInterface $date, ChronosInterface $other =
public function timeAgoInWords(DatetimeInterface $time, array $options = [])
{
$options = $this->_options($options, FrozenTime::class);
if ($options['timezone']) {
if ($options['timezone'] && $time instanceof ChronosInterface) {
$time = $time->timezone($options['timezone']);
}

Expand Down Expand Up @@ -284,7 +284,7 @@ protected function _diffData($futureTime, $pastTime, $backwards, $options)
public function dateAgoInWords(DatetimeInterface $date, array $options = [])
{
$options = $this->_options($options, FrozenDate::class);
if ($options['timezone']) {
if ($options['timezone'] && $date instanceof ChronosInterface) {
$date = $date->timezone($options['timezone']);
}

Expand Down

0 comments on commit 7a01ea4

Please sign in to comment.