forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp_date.stub.php
832 lines (665 loc) · 20.4 KB
/
php_date.stub.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
<?php
/** @generate-class-entries */
/**
* @var string
* @cvalue DATE_FORMAT_RFC3339
*/
const DATE_ATOM = "Y-m-d\\TH:i:sP";
/**
* @var string
* @cvalue DATE_FORMAT_COOKIE
*/
const DATE_COOKIE = "l, d-M-Y H:i:s T";
/**
* @var string
* @cvalue DATE_FORMAT_ISO8601
*/
const DATE_ISO8601 = "Y-m-d\\TH:i:sO";
/**
* @var string
* @cvalue DATE_FORMAT_ISO8601_EXPANDED
*/
const DATE_ISO8601_EXPANDED = "X-m-d\\TH:i:sP";
/**
* @var string
* @cvalue DATE_FORMAT_RFC822
*/
const DATE_RFC822 = "D, d M y H:i:s O";
/**
* @var string
* @cvalue DATE_FORMAT_RFC850
*/
const DATE_RFC850 = "l, d-M-y H:i:s T";
/**
* @var string
* @cvalue DATE_FORMAT_RFC1036
*/
const DATE_RFC1036 = "D, d M y H:i:s O";
/**
* @var string
* @cvalue DATE_FORMAT_RFC1123
*/
const DATE_RFC1123 = "D, d M Y H:i:s O";
/**
* @var string
* @cvalue DATE_FORMAT_RFC7231
*/
const DATE_RFC7231 = "D, d M Y H:i:s \\G\\M\\T";
/**
* @var string
* @cvalue DATE_FORMAT_RFC2822
*/
const DATE_RFC2822 = "D, d M Y H:i:s O";
/**
* @var string
* @cvalue DATE_FORMAT_RFC3339
*/
const DATE_RFC3339 = "Y-m-d\\TH:i:sP";
/**
* @var string
* @cvalue DATE_FORMAT_RFC3339_EXTENDED
*/
const DATE_RFC3339_EXTENDED = "Y-m-d\\TH:i:s.vP";
/** @var string */
const DATE_RSS = DATE_RFC1123;
/** @var string */
const DATE_W3C = DATE_RFC3339;
/**
* @var int
* @cvalue SUNFUNCS_RET_TIMESTAMP
*/
const SUNFUNCS_RET_TIMESTAMP = UNKNOWN;
/**
* @var int
* @cvalue SUNFUNCS_RET_STRING
*/
const SUNFUNCS_RET_STRING = UNKNOWN;
/**
* @var int
* @cvalue SUNFUNCS_RET_DOUBLE
*/
const SUNFUNCS_RET_DOUBLE = UNKNOWN;
function strtotime(string $datetime, ?int $baseTimestamp = null): int|false {}
/** @refcount 1 */
function date(string $format, ?int $timestamp = null): string {}
function idate(string $format, ?int $timestamp = null): int|false {}
/** @refcount 1 */
function gmdate(string $format, ?int $timestamp = null): string {}
function mktime(
int $hour, ?int $minute = null, ?int $second = null,
?int $month = null, ?int $day = null, ?int $year = null): int|false {}
function gmmktime(
int $hour, ?int $minute = null, ?int $second = null,
?int $month = null, ?int $day = null, ?int $year = null): int|false {}
function checkdate(int $month, int $day, int $year): bool {}
/**
* @refcount 1
* @deprecated
*/
function strftime(string $format, ?int $timestamp = null): string|false {}
/**
* @refcount 1
* @deprecated
*/
function gmstrftime(string $format, ?int $timestamp = null): string|false {}
function time(): int {}
/**
* @return array<int|string, int>
* @refcount 1
*/
function localtime(?int $timestamp = null, bool $associative = false): array {}
/**
* @return array<int|string, int|string>
* @refcount 1
*/
function getdate(?int $timestamp = null): array {}
/** @refcount 1 */
function date_create(string $datetime = "now", ?DateTimeZone $timezone = null): DateTime|false {}
/** @refcount 1 */
function date_create_immutable(
string $datetime = "now", ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
/** @refcount 1 */
function date_create_from_format(
string $format, string $datetime, ?DateTimeZone $timezone = null): DateTime|false {}
/** @refcount 1 */
function date_create_immutable_from_format(
string $format, string $datetime, ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
/**
* @return array<string, mixed>
* @refcount 1
*/
function date_parse(string $datetime): array {}
/**
* @return array<string, mixed>
* @refcount 1
*/
function date_parse_from_format(string $format, string $datetime): array {}
/**
* @return array<string, int|array>|false
* @refcount 1
*/
function date_get_last_errors(): array|false {}
/** @refcount 1 */
function date_format(DateTimeInterface $object, string $format): string {}
function date_modify(DateTime $object, string $modifier): DateTime|false {}
function date_add(DateTime $object, DateInterval $interval): DateTime {}
function date_sub(DateTime $object, DateInterval $interval): DateTime {}
/** @refcount 1 */
function date_timezone_get(DateTimeInterface $object): DateTimeZone|false {}
function date_timezone_set(DateTime $object, DateTimeZone $timezone): DateTime {}
function date_offset_get(DateTimeInterface $object): int {}
/** @refcount 1 */
function date_diff(
DateTimeInterface $baseObject, DateTimeInterface $targetObject, bool $absolute = false): DateInterval {}
function date_time_set(
DateTime $object, int $hour, int $minute, int $second = 0, int $microsecond = 0): DateTime {}
function date_date_set(DateTime $object, int $year, int $month, int $day): DateTime {}
function date_isodate_set(DateTime $object, int $year, int $week, int $dayOfWeek = 1): DateTime {}
function date_timestamp_set(DateTime $object, int $timestamp): DateTime {}
function date_timestamp_get(DateTimeInterface $object): int {}
/** @refcount 1 */
function timezone_open(string $timezone): DateTimeZone|false {}
/** @refcount 1 */
function timezone_name_get(DateTimeZone $object): string {}
/** @refcount 1 */
function timezone_name_from_abbr(string $abbr, int $utcOffset = -1, int $isDST = -1): string|false {}
function timezone_offset_get(DateTimeZone $object, DateTimeInterface $datetime): int {}
/**
* @return array<int, array>|false
* @refcount 1
*/
function timezone_transitions_get(
DateTimeZone $object, int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX): array|false {}
/**
* @return array<string, float|string>|false
* @refcount 1
*/
function timezone_location_get(DateTimeZone $object): array|false {}
/**
* @return array<int, string>
* @refcount 1
*/
function timezone_identifiers_list(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array {}
/**
* @return array<string, array>
* @refcount 1
*/
function timezone_abbreviations_list(): array {}
/** @refcount 1 */
function timezone_version_get(): string {}
/** @refcount 1 */
function date_interval_create_from_date_string(string $datetime): DateInterval|false {}
/** @refcount 1 */
function date_interval_format(DateInterval $object, string $format): string {}
function date_default_timezone_set(string $timezoneId): bool {}
/** @refcount 1 */
function date_default_timezone_get(): string {}
/**
* @refcount 1
* @deprecated
*/
function date_sunrise(
int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING,
?float $latitude = null, ?float $longitude = null, ?float $zenith = null,
?float $utcOffset = null): string|int|float|false {}
/**
* @refcount 1
* @deprecated
*/
function date_sunset(
int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING,
?float $latitude = null, ?float $longitude = null, ?float $zenith = null,
?float $utcOffset = null): string|int|float|false {}
/**
* @return array<string, bool|int>
* @refcount 1
*/
function date_sun_info(int $timestamp, float $latitude, float $longitude): array {}
interface DateTimeInterface
{
/** @var string */
public const ATOM = DATE_ATOM;
/** @var string */
public const COOKIE = DATE_COOKIE;
/** @var string */
public const ISO8601 = DATE_ISO8601;
/** @var string */
public const ISO8601_EXPANDED = DATE_ISO8601_EXPANDED;
/** @var string */
public const RFC822 = DATE_RFC822;
/** @var string */
public const RFC850 = DATE_RFC850;
/** @var string */
public const RFC1036 = DATE_RFC1036;
/** @var string */
public const RFC1123 = DATE_RFC1123;
/** @var string */
public const RFC7231 = DATE_RFC7231;
/** @var string */
public const RFC2822 = DATE_RFC2822;
/** @var string */
public const RFC3339 = DATE_RFC3339;
/** @var string */
public const RFC3339_EXTENDED = DATE_RFC3339_EXTENDED;
/** @var string */
public const RSS = DATE_RSS;
/** @var string */
public const W3C = DATE_W3C;
/** @tentative-return-type */
public function format(string $format): string;
/** @tentative-return-type */
public function getTimezone(): DateTimeZone|false;
/** @tentative-return-type */
public function getOffset(): int;
/** @tentative-return-type */
public function getTimestamp(): int;
public function getMicrosecond(): int;
/** @tentative-return-type */
public function diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval;
/** @tentative-return-type */
public function __wakeup(): void;
public function __serialize(): array;
public function __unserialize(array $data): void;
}
class DateTime implements DateTimeInterface
{
public function __construct(string $datetime = "now", ?DateTimeZone $timezone = null) {}
public function __serialize(): array {}
public function __unserialize(array $data): void {}
/** @tentative-return-type */
public function __wakeup(): void {}
/** @tentative-return-type */
public static function __set_state(array $array): DateTime {}
/** @tentative-return-type */
public static function createFromImmutable(DateTimeImmutable $object): static {}
/** @return static */
public static function createFromInterface(DateTimeInterface $object): DateTime {} // TODO return type should be static
/**
* @tentative-return-type
* @alias date_create_from_format
*/
public static function createFromFormat(string $format, string $datetime, ?DateTimeZone $timezone = null): DateTime|false {}
/** @tentative-return-type */
public static function createFromTimestamp(int|float $timestamp): static {}
/**
* @return array<string, int|array>|false
* @tentative-return-type
* @alias date_get_last_errors
*/
public static function getLastErrors(): array|false {}
/**
* @tentative-return-type
* @alias date_format
*/
public function format(string $format): string {}
/**
* @tentative-return-type
*/
public function modify(string $modifier): DateTime|false {}
/**
* @tentative-return-type
* @alias date_add
*/
public function add(DateInterval $interval): DateTime {}
/**
* @tentative-return-type
*/
public function sub(DateInterval $interval): DateTime {}
/**
* @tentative-return-type
* @alias date_timezone_get
*/
public function getTimezone(): DateTimeZone|false {}
/**
* @tentative-return-type
* @alias date_timezone_set
*/
public function setTimezone(DateTimeZone $timezone): DateTime {}
/**
* @tentative-return-type
* @alias date_offset_get
*/
public function getOffset(): int {}
public function getMicrosecond(): int {}
/**
* @tentative-return-type
* @alias date_time_set
*/
public function setTime(int $hour, int $minute, int $second = 0, int $microsecond = 0): DateTime {}
/**
* @tentative-return-type
* @alias date_date_set
*/
public function setDate(int $year, int $month, int $day): DateTime {}
/**
* @tentative-return-type
* @alias date_isodate_set
*/
public function setISODate(int $year, int $week, int $dayOfWeek = 1): DateTime {}
/**
* @tentative-return-type
* @alias date_timestamp_set
*/
public function setTimestamp(int $timestamp): DateTime {}
public function setMicrosecond(int $microsecond): static {}
/**
* @tentative-return-type
* @alias date_timestamp_get
*/
public function getTimestamp(): int {}
/**
* @tentative-return-type
* @alias date_diff
*/
public function diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval {}
}
class DateTimeImmutable implements DateTimeInterface
{
public function __construct(string $datetime = "now", ?DateTimeZone $timezone = null) {}
public function __serialize(): array {}
public function __unserialize(array $data): void {}
/** @tentative-return-type */
public function __wakeup(): void {}
/** @tentative-return-type */
public static function __set_state(array $array): DateTimeImmutable {}
/**
* @tentative-return-type
* @alias date_create_immutable_from_format
*/
public static function createFromFormat(string $format, string $datetime, ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
/** @tentative-return-type */
public static function createFromTimestamp(int|float $timestamp): static {}
/**
* @return array<string, int|array>|false
* @tentative-return-type
* @alias date_get_last_errors
*/
public static function getLastErrors(): array|false {}
/**
* @tentative-return-type
* @alias date_format
*/
public function format(string $format): string {}
/**
* @tentative-return-type
* @alias date_timezone_get
*/
public function getTimezone(): DateTimeZone|false {}
/**
* @tentative-return-type
* @alias date_offset_get
*/
public function getOffset(): int {}
/**
* @tentative-return-type
* @alias date_timestamp_get
*/
public function getTimestamp(): int {}
/**
* @alias DateTime::getMicrosecond
*/
public function getMicrosecond(): int {}
/**
* @tentative-return-type
* @alias date_diff
*/
public function diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval {}
/** @tentative-return-type */
public function modify(string $modifier): DateTimeImmutable|false {}
/** @tentative-return-type */
public function add(DateInterval $interval): DateTimeImmutable {}
/** @tentative-return-type */
public function sub(DateInterval $interval): DateTimeImmutable {}
/** @tentative-return-type */
public function setTimezone(DateTimeZone $timezone): DateTimeImmutable {}
/** @tentative-return-type */
public function setTime(int $hour, int $minute, int $second = 0, int $microsecond = 0): DateTimeImmutable {}
/** @tentative-return-type */
public function setDate(int $year, int $month, int $day): DateTimeImmutable {}
/** @tentative-return-type */
public function setISODate(int $year, int $week, int $dayOfWeek = 1): DateTimeImmutable {}
/** @tentative-return-type */
public function setTimestamp(int $timestamp): DateTimeImmutable {}
public function setMicrosecond(int $microsecond): static {}
/** @tentative-return-type */
public static function createFromMutable(DateTime $object): static {}
/** @return static */
public static function createFromInterface(DateTimeInterface $object): DateTimeImmutable {} // TODO return type should be static
}
class DateTimeZone
{
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_AFRICA
*/
public const AFRICA = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_AMERICA
*/
public const AMERICA = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_ANTARCTICA
*/
public const ANTARCTICA = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_ARCTIC
*/
public const ARCTIC = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_ASIA
*/
public const ASIA = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_ATLANTIC
*/
public const ATLANTIC = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_AUSTRALIA
*/
public const AUSTRALIA = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_EUROPE
*/
public const EUROPE = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_INDIAN
*/
public const INDIAN = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_PACIFIC
*/
public const PACIFIC = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_UTC
*/
public const UTC = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_ALL
*/
public const ALL = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_GROUP_ALL_W_BC
*/
public const ALL_WITH_BC = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_TIMEZONE_PER_COUNTRY
*/
public const PER_COUNTRY = UNKNOWN;
public function __construct(string $timezone) {}
/**
* @tentative-return-type
* @alias timezone_name_get
*/
public function getName(): string {}
/**
* @tentative-return-type
* @alias timezone_offset_get
*/
public function getOffset(DateTimeInterface $datetime): int {}
/**
* @return array<int, array>|false
* @tentative-return-type
* @alias timezone_transitions_get
*/
public function getTransitions(int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX): array|false {}
/**
* @return array<string, float|string>|false
* @tentative-return-type
* @alias timezone_location_get
*/
public function getLocation(): array|false {}
/**
* @return array<string, array>
* @tentative-return-type
* @alias timezone_abbreviations_list
*/
public static function listAbbreviations(): array {}
/**
* @return array<int, string>
* @tentative-return-type
* @alias timezone_identifiers_list
*/
public static function listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array {}
public function __serialize(): array {}
public function __unserialize(array $data): void {}
/** @tentative-return-type */
public function __wakeup(): void {}
/** @tentative-return-type */
public static function __set_state(array $array): DateTimeZone {}
}
class DateInterval
{
public function __construct(string $duration) {}
/**
* @tentative-return-type
*/
public static function createFromDateString(string $datetime): DateInterval|false {}
/**
* @tentative-return-type
* @alias date_interval_format
*/
public function format(string $format): string {}
public function __serialize(): array;
public function __unserialize(array $data): void;
/** @tentative-return-type */
public function __wakeup(): void {}
/** @tentative-return-type */
public static function __set_state(array $array): DateInterval {}
}
class DatePeriod implements IteratorAggregate
{
/**
* @var int
* @cvalue PHP_DATE_PERIOD_EXCLUDE_START_DATE
*/
public const EXCLUDE_START_DATE = UNKNOWN;
/**
* @var int
* @cvalue PHP_DATE_PERIOD_INCLUDE_END_DATE
*/
public const INCLUDE_END_DATE = UNKNOWN;
/** @readonly */
public ?DateTimeInterface $start;
/** @readonly */
public ?DateTimeInterface $current;
/** @readonly */
public ?DateTimeInterface $end;
/** @readonly */
public ?DateInterval $interval;
/** @readonly */
public int $recurrences;
/** @readonly */
public bool $include_start_date;
/** @readonly */
public bool $include_end_date;
public static function createFromISO8601String(string $specification, int $options = 0): static {}
/**
* @param DateTimeInterface|string $start
* @param DateInterval|int $interval
* @param DateTimeInterface|int $end
* @param int $options
*/
public function __construct($start, $interval = UNKNOWN, $end = UNKNOWN, $options = UNKNOWN) {}
/** @tentative-return-type */
public function getStartDate(): DateTimeInterface {}
/** @tentative-return-type */
public function getEndDate(): ?DateTimeInterface {}
/** @tentative-return-type */
public function getDateInterval(): DateInterval {}
/** @tentative-return-type */
public function getRecurrences(): ?int {}
public function __serialize(): array;
public function __unserialize(array $data): void;
/** @tentative-return-type */
public function __wakeup(): void {}
/** @tentative-return-type */
public static function __set_state(array $array): DatePeriod {}
public function getIterator(): Iterator {}
}
/**
* @strict-properties
*/
class DateError extends Error
{
}
/**
* @strict-properties
*/
class DateObjectError extends DateError
{
}
/**
* @strict-properties
*/
class DateRangeError extends DateError
{
}
/**
* @strict-properties
*/
class DateException extends Exception
{
}
/**
* @strict-properties
*/
class DateInvalidTimeZoneException extends DateException
{
}
/**
* @strict-properties
*/
class DateInvalidOperationException extends DateException
{
}
/**
* @strict-properties
*/
class DateMalformedStringException extends DateException
{
}
/**
* @strict-properties
*/
class DateMalformedIntervalStringException extends DateException
{
}
/**
* @strict-properties
*/
class DateMalformedPeriodStringException extends DateException
{
}