@@ -74,7 +74,12 @@ public function format(mixed $format)[]: string;
74
74
*
75
75
*/
76
76
<<__Native >>
77
- public static function getLastErrors ()[read_globals]: darray ;
77
+ public static function getLastErrors ()[read_globals]: shape(
78
+ ' warning_count' => int ,
79
+ ' warnings' => dict <int , string >,
80
+ ' error_count' => int ,
81
+ ' errors' => dict <int , string >
82
+ ) ;
78
83
79
84
/**
80
85
* Returns the timezone offset.
@@ -201,13 +206,13 @@ public function setTimezone(DateTimeZone $timezone)[write_props]: mixed;
201
206
public function sub (DateInterval $interval )[write_props]: mixed ;
202
207
203
208
<<__Native >>
204
- public function __sleep ()[write_props]: varray ;
209
+ public function __sleep ()[write_props]: varray < string > ;
205
210
206
211
<<__Native >>
207
212
public function __wakeup ()[]: void ;
208
213
209
214
<<__Native >>
210
- public function __debugInfo ()[]: darray ;
215
+ public function __debugInfo ()[]: darray < string , mixed > ;
211
216
212
217
}
213
218
@@ -232,7 +237,12 @@ public function __construct(string $timezone)[]: void;
232
237
*
233
238
*/
234
239
<<__Native >>
235
- public function getLocation ()[]: darray ;
240
+ public function getLocation ()[]: shape(
241
+ ' country_code' => string ,
242
+ ' latitude' => float ,
243
+ ' longitude' => float ,
244
+ ' comments' => string ,
245
+ ) ;
236
246
237
247
/**
238
248
* Returns the name of the timezone.
@@ -267,12 +277,19 @@ public function getOffset(DateTimeInterface $datetime)[]: mixed;
267
277
public function getTransitions (int $timestamp_begin = PHP_INT_MIN ,
268
278
int $timestamp_end = PHP_INT_MAX )[]: mixed ;
269
279
280
+
281
+ const type TAbbrev = shape (
282
+ ' dst' => bool ,
283
+ ' offset' => float ,
284
+ ' timezone_id' => ?string ,
285
+ );
270
286
/**
271
287
* @return array - Returns array on success or FALSE on failure.
272
288
*
273
289
*/
274
290
<<__Native >>
275
- public static function listAbbreviations ()[]: darray ;
291
+ public static function listAbbreviations (
292
+ )[]: dict <string , vec <this ::TAbbrev >>;
276
293
277
294
/**
278
295
* @param int $what - One of DateTimeZone class constants.
@@ -287,7 +304,7 @@ public static function listIdentifiers(int $what = 2047,
287
304
string $country = " " )[]: mixed ;
288
305
289
306
<<__Native >>
290
- public function __debugInfo (): darray ;
307
+ public function __debugInfo (): darray < string , mixed > ;
291
308
}
292
309
293
310
/**
@@ -406,7 +423,12 @@ function date_default_timezone_get(): string;
406
423
<<__Native >>
407
424
function date_default_timezone_set (string $name ): bool ;
408
425
409
- function date_get_last_errors (): darray {
426
+ function date_get_last_errors ()[read_globals]: shape(
427
+ ' warning_count' => int ,
428
+ ' warnings' => dict <int , string >,
429
+ ' error_count' => int ,
430
+ ' errors' => dict <int , string >
431
+ ) {
410
432
return DateTime :: getLastErrors();
411
433
}
412
434
@@ -422,7 +444,7 @@ function date_interval_format(DateInterval $interval,
422
444
function date_isodate_set (DateTime $datetime ,
423
445
int $year ,
424
446
int $week ,
425
- int $day = 1 ): void {
447
+ int $day = 1 ): DateTime {
426
448
return $datetime -> setISODate($year , $week , $day );
427
449
}
428
450
@@ -451,12 +473,19 @@ function date_sub(DateTime $datetime, DateInterval $interval): mixed {
451
473
* @param int $ts - Timestamp.
452
474
* @param float $latitude - Latitude in degrees.
453
475
* @param float $longitude - Longitude in degrees.
454
- *
455
- * @return array - Returns array on success or FALSE on failure.
456
- *
457
476
*/
458
477
<<__Native >>
459
- function date_sun_info (int $ts , float $latitude , float $longitude ): darray ;
478
+ function date_sun_info (int $ts , float $latitude , float $longitude ): shape(
479
+ ' sunrise' => mixed ,
480
+ ' sunset' => mixed ,
481
+ ' transit' => int ,
482
+ ' civil_twilight_begin' => mixed ,
483
+ ' civil_twilight_end' => mixed ,
484
+ ' nautical_twilight_begin' => mixed ,
485
+ ' nautical_twilight_end' => mixed ,
486
+ ' astronomical_twilight_begin' => mixed ,
487
+ ' astronomical_twilight_end' => mixed ,
488
+ ) ;
460
489
461
490
/**
462
491
* date_sunrise() returns the sunrise time for a given day (specified as a
@@ -556,7 +585,19 @@ function date(string $format, ?int $timestamp = null): mixed;
556
585
*
557
586
*/
558
587
<<__Native >>
559
- function getdate (?int $timestamp = null ): darray ;
588
+ function getdate (?int $timestamp = null ): shape(
589
+ ' seconds' => int ,
590
+ ' minutes' => int ,
591
+ ' hours' => int ,
592
+ ' mday' => int ,
593
+ ' wday' => int ,
594
+ ' mon' => int ,
595
+ ' year' => int ,
596
+ ' yday' => int ,
597
+ ' weekday' => string ,
598
+ ' month' => string ,
599
+ ...
600
+ ) ;
560
601
561
602
/**
562
603
* This is an interface to gettimeofday(2). It returns an associative array
@@ -682,7 +723,7 @@ function idate(string $format, ?int $timestamp = null): mixed;
682
723
*/
683
724
<<__Native >>
684
725
function localtime (?int $timestamp = null ,
685
- bool $is_associative = false ): varray_or_darray ;
726
+ bool $is_associative = false ): varray_or_darray < mixed > ;
686
727
687
728
/**
688
729
* microtime() returns the current Unix timestamp with microseconds. This
@@ -799,7 +840,8 @@ function strtotime(string $input, ?int $timestamp = null)[leak_safe]: mixed;
799
840
<<__Native >>
800
841
function time ()[leak_safe]: int ;
801
842
802
- function timezone_abbreviations_list (): darray {
843
+ function timezone_abbreviations_list (
844
+ ): ?dict <string , vec <DateTimeZone ::TAbbrev >> {
803
845
return DateTimeZone :: listAbbreviations();
804
846
}
805
847
@@ -816,7 +858,12 @@ function timezone_identifiers_list(int $what = 2047,
816
858
return DateTimeZone :: listIdentifiers($what , $country );
817
859
}
818
860
819
- function timezone_location_get (DateTimeZone $timezone ): darray {
861
+ function timezone_location_get (DateTimeZone $timezone ): ?shape(
862
+ ' country_code' => string ,
863
+ ' latitude' => float ,
864
+ ' longitude' => float ,
865
+ ' comments' => string ,
866
+ ) {
820
867
return $timezone -> getLocation();
821
868
}
822
869
@@ -853,7 +900,7 @@ function timezone_open(string $timezone): mixed {
853
900
catch (Exception $e ) {
854
901
$msg = str_replace (" DateTimeZone::__construct" , " timezone_open" ,
855
902
$e -> getMessage());
856
- trigger_error ($msg , E_WARNING );
903
+ trigger_error (HH \ FIXME \ UNSAFE_CAST < mixed , string > ( $msg ) , E_WARNING );
857
904
return false ;
858
905
}
859
906
}
0 commit comments