Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
[zendframework/zendframework#5295] consistent version checking
Browse files Browse the repository at this point in the history
- use PHP_VERSION_ID always
- comparison should be against integers
  • Loading branch information
weierophinney committed Oct 23, 2013
1 parent c9ac507 commit 088bad2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/View/Helper/DateFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function __invoke(
}

// DateTime support for IntlDateFormatter::format() was only added in 5.3.4
if ($date instanceof DateTime && version_compare(PHP_VERSION, '5.3.4', '<')) {
if ($date instanceof DateTime && (PHP_VERSION_ID < 50304)) {
$date = $date->getTimestamp();
}

Expand Down Expand Up @@ -134,7 +134,7 @@ public function setTimezone($timezone)
$this->timezone = (string) $timezone;

// The method setTimeZoneId is deprecated as of PHP 5.5.0
$setTimeZoneMethodName = (PHP_VERSION_ID < '50500') ? 'setTimeZoneId' : 'setTimeZone';
$setTimeZoneMethodName = (PHP_VERSION_ID < 50500) ? 'setTimeZoneId' : 'setTimeZone';

foreach ($this->formatters as $formatter) {
$formatter->$setTimeZoneMethodName($this->timezone);
Expand Down

0 comments on commit 088bad2

Please sign in to comment.