Skip to content

Commit

Permalink
Merge pull request #4 from TiberiuD/master
Browse files Browse the repository at this point in the history
Removed never reachable if statement
  • Loading branch information
alphp authored Apr 1, 2022
2 parents 69e27c6 + 785ca61 commit f22f57e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/php-8.1-strftime.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@
* @author BohwaZ <https://bohwaz.net/>
*/
function strftime (string $format, $timestamp = null, ?string $locale = null) : string {
$timestamp = is_int($timestamp) ? '@' . $timestamp : (string) $timestamp;

$timestamp = new DateTime($timestamp);

if (!($timestamp instanceof DateTimeInterface)) {
throw new InvalidArgumentException('$timestamp argument is neither a valid UNIX timestamp, a valid date-time string or a DateTime object.');
$timestamp = is_int($timestamp) ? '@' . $timestamp : (string) $timestamp;

$timestamp = new DateTime($timestamp);
}

$timestamp->setTimezone(new DateTimeZone(date_default_timezone_get()));
Expand Down

0 comments on commit f22f57e

Please sign in to comment.