Skip to content

Commit a6b795a

Browse files
authored
Merge pull request #245 from thecodingmachine/create-pull-request/regenerate-files
Automatically regenerate the files
2 parents 1114828 + 6462a5c commit a6b795a

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"generated/apcu.php",
2121
"generated/array.php",
2222
"generated/bzip2.php",
23+
"generated/calendar.php",
2324
"generated/classobj.php",
2425
"generated/com.php",
2526
"generated/cubrid.php",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
namespace Safe\Exceptions;
3+
4+
class CalendarException extends \ErrorException implements SafeExceptionInterface
5+
{
6+
public static function createFromPhpError(): self
7+
{
8+
$error = error_get_last();
9+
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
10+
}
11+
}

generated/calendar.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Safe;
4+
5+
use Safe\Exceptions\CalendarException;
6+
7+
/**
8+
* This function will return a Unix timestamp corresponding to the
9+
* Julian Day given in jday or FALSE if
10+
* jday is outside of the allowed range. The time returned is
11+
* UTC.
12+
*
13+
* @param int $jday A julian day number between 2440588 and 106751993607888
14+
* on 64bit systems, or between 2440588 and 2465443 on 32bit systems.
15+
* @return int The unix timestamp for the start (midnight, not noon) of the given Julian day.
16+
* @throws CalendarException
17+
*
18+
*/
19+
function jdtounix(int $jday): int
20+
{
21+
error_clear_last();
22+
$result = \jdtounix($jday);
23+
if ($result === false) {
24+
throw CalendarException::createFromPhpError();
25+
}
26+
return $result;
27+
}

generated/functionsList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@
374374
'inotify_rm_watch',
375375
'iptcembed',
376376
'iptcparse',
377+
'jdtounix',
377378
'jpeg2wbmp',
378379
'json_decode',
379380
'json_encode',

rector-migrate-0.7.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@
384384
'inotify_rm_watch' => 'Safe\inotify_rm_watch',
385385
'iptcembed' => 'Safe\iptcembed',
386386
'iptcparse' => 'Safe\iptcparse',
387+
'jdtounix' => 'Safe\jdtounix',
387388
'jpeg2wbmp' => 'Safe\jpeg2wbmp',
388389
'json_decode' => 'Safe\json_decode',
389390
'json_encode' => 'Safe\json_encode',

0 commit comments

Comments
 (0)