php_date.stub.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. <?php
  2. /** @generate-class-entries */
  3. function strtotime(string $datetime, ?int $baseTimestamp = null): int|false {}
  4. /** @refcount 1 */
  5. function date(string $format, ?int $timestamp = null): string {}
  6. function idate(string $format, ?int $timestamp = null): int|false {}
  7. /** @refcount 1 */
  8. function gmdate(string $format, ?int $timestamp = null): string {}
  9. function mktime(
  10. int $hour, ?int $minute = null, ?int $second = null,
  11. ?int $month = null, ?int $day = null, ?int $year = null): int|false {}
  12. function gmmktime(
  13. int $hour, ?int $minute = null, ?int $second = null,
  14. ?int $month = null, ?int $day = null, ?int $year = null): int|false {}
  15. function checkdate(int $month, int $day, int $year): bool {}
  16. /**
  17. * @refcount 1
  18. * @deprecated
  19. */
  20. function strftime(string $format, ?int $timestamp = null): string|false {}
  21. /**
  22. * @refcount 1
  23. * @deprecated
  24. */
  25. function gmstrftime(string $format, ?int $timestamp = null): string|false {}
  26. function time(): int {}
  27. /**
  28. * @return array<int|string, int>
  29. * @refcount 1
  30. */
  31. function localtime(?int $timestamp = null, bool $associative = false): array {}
  32. /**
  33. * @return array<int|string, int|string>
  34. * @refcount 1
  35. */
  36. function getdate(?int $timestamp = null): array {}
  37. /** @refcount 1 */
  38. function date_create(string $datetime = "now", ?DateTimeZone $timezone = null): DateTime|false {}
  39. /** @refcount 1 */
  40. function date_create_immutable(
  41. string $datetime = "now", ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
  42. /** @refcount 1 */
  43. function date_create_from_format(
  44. string $format, string $datetime, ?DateTimeZone $timezone = null): DateTime|false {}
  45. /** @refcount 1 */
  46. function date_create_immutable_from_format(
  47. string $format, string $datetime, ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
  48. /**
  49. * @return array<string, mixed>
  50. * @refcount 1
  51. */
  52. function date_parse(string $datetime): array {}
  53. /**
  54. * @return array<string, mixed>
  55. * @refcount 1
  56. */
  57. function date_parse_from_format(string $format, string $datetime): array {}
  58. /**
  59. * @return array<string, int|array>|false
  60. * @refcount 1
  61. */
  62. function date_get_last_errors(): array|false {}
  63. /** @refcount 1 */
  64. function date_format(DateTimeInterface $object, string $format): string {}
  65. function date_modify(DateTime $object, string $modifier): DateTime|false {}
  66. function date_add(DateTime $object, DateInterval $interval): DateTime {}
  67. function date_sub(DateTime $object, DateInterval $interval): DateTime {}
  68. /** @refcount 1 */
  69. function date_timezone_get(DateTimeInterface $object): DateTimeZone|false {}
  70. function date_timezone_set(DateTime $object, DateTimeZone $timezone): DateTime {}
  71. function date_offset_get(DateTimeInterface $object): int {}
  72. /** @refcount 1 */
  73. function date_diff(
  74. DateTimeInterface $baseObject, DateTimeInterface $targetObject, bool $absolute = false): DateInterval {}
  75. function date_time_set(
  76. DateTime $object, int $hour, int $minute, int $second = 0, int $microsecond = 0): DateTime {}
  77. function date_date_set(DateTime $object, int $year, int $month, int $day): DateTime {}
  78. function date_isodate_set(DateTime $object, int $year, int $week, int $dayOfWeek = 1): DateTime {}
  79. function date_timestamp_set(DateTime $object, int $timestamp): DateTime {}
  80. function date_timestamp_get(DateTimeInterface $object): int {}
  81. /** @refcount 1 */
  82. function timezone_open(string $timezone): DateTimeZone|false {}
  83. /** @refcount 1 */
  84. function timezone_name_get(DateTimeZone $object): string {}
  85. /** @refcount 1 */
  86. function timezone_name_from_abbr(string $abbr, int $utcOffset = -1, int $isDST = -1): string|false {}
  87. function timezone_offset_get(DateTimeZone $object, DateTimeInterface $datetime): int {}
  88. /**
  89. * @return array<int, array>|false
  90. * @refcount 1
  91. */
  92. function timezone_transitions_get(
  93. DateTimeZone $object, int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX): array|false {}
  94. /**
  95. * @return array<string, float|string>|false
  96. * @refcount 1
  97. */
  98. function timezone_location_get(DateTimeZone $object): array|false {}
  99. /**
  100. * @return array<int, string>
  101. * @refcount 1
  102. */
  103. function timezone_identifiers_list(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array {}
  104. /**
  105. * @return array<string, array>
  106. * @refcount 1
  107. */
  108. function timezone_abbreviations_list(): array {}
  109. /** @refcount 1 */
  110. function timezone_version_get(): string {}
  111. /** @refcount 1 */
  112. function date_interval_create_from_date_string(string $datetime): DateInterval|false {}
  113. /** @refcount 1 */
  114. function date_interval_format(DateInterval $object, string $format): string {}
  115. function date_default_timezone_set(string $timezoneId): bool {}
  116. /** @refcount 1 */
  117. function date_default_timezone_get(): string {}
  118. /**
  119. * @refcount 1
  120. * @deprecated
  121. */
  122. function date_sunrise(
  123. int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING,
  124. ?float $latitude = null, ?float $longitude = null, ?float $zenith = null,
  125. ?float $utcOffset = null): string|int|float|false {}
  126. /**
  127. * @refcount 1
  128. * @deprecated
  129. */
  130. function date_sunset(
  131. int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING,
  132. ?float $latitude = null, ?float $longitude = null, ?float $zenith = null,
  133. ?float $utcOffset = null): string|int|float|false {}
  134. /**
  135. * @return array<string, bool|int>
  136. * @refcount 1
  137. */
  138. function date_sun_info(int $timestamp, float $latitude, float $longitude): array {}
  139. interface DateTimeInterface
  140. {
  141. /** @tentative-return-type */
  142. public function format(string $format): string;
  143. /** @tentative-return-type */
  144. public function getTimezone(): DateTimeZone|false;
  145. /** @tentative-return-type */
  146. public function getOffset(): int;
  147. /** @tentative-return-type */
  148. public function getTimestamp(): int;
  149. /** @tentative-return-type */
  150. public function diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval;
  151. /** @tentative-return-type */
  152. public function __wakeup(): void;
  153. }
  154. class DateTime implements DateTimeInterface
  155. {
  156. public function __construct(string $datetime = "now", ?DateTimeZone $timezone = null) {}
  157. /** @tentative-return-type */
  158. public function __wakeup(): void {}
  159. /** @tentative-return-type */
  160. public static function __set_state(array $array): DateTime {}
  161. /** @tentative-return-type */
  162. public static function createFromImmutable(DateTimeImmutable $object): DateTime {}
  163. public static function createFromInterface(DateTimeInterface $object): DateTime {}
  164. /**
  165. * @tentative-return-type
  166. * @alias date_create_from_format
  167. */
  168. public static function createFromFormat(string $format, string $datetime, ?DateTimeZone $timezone = null): DateTime|false {}
  169. /**
  170. * @return array<string, int|array>|false
  171. * @tentative-return-type
  172. * @alias date_get_last_errors
  173. */
  174. public static function getLastErrors(): array|false {}
  175. /**
  176. * @tentative-return-type
  177. * @alias date_format
  178. */
  179. public function format(string $format): string {}
  180. /**
  181. * @tentative-return-type
  182. * @alias date_modify
  183. */
  184. public function modify(string $modifier): DateTime|false {}
  185. /**
  186. * @tentative-return-type
  187. * @alias date_add
  188. */
  189. public function add(DateInterval $interval): DateTime {}
  190. /**
  191. * @tentative-return-type
  192. * @alias date_sub
  193. */
  194. public function sub(DateInterval $interval): DateTime {}
  195. /**
  196. * @tentative-return-type
  197. * @alias date_timezone_get
  198. */
  199. public function getTimezone(): DateTimeZone|false {}
  200. /**
  201. * @tentative-return-type
  202. * @alias date_timezone_set
  203. */
  204. public function setTimezone(DateTimeZone $timezone): DateTime {}
  205. /**
  206. * @tentative-return-type
  207. * @alias date_offset_get
  208. */
  209. public function getOffset(): int {}
  210. /**
  211. * @tentative-return-type
  212. * @alias date_time_set
  213. */
  214. public function setTime(int $hour, int $minute, int $second = 0, int $microsecond = 0): DateTime {}
  215. /**
  216. * @tentative-return-type
  217. * @alias date_date_set
  218. */
  219. public function setDate(int $year, int $month, int $day): DateTime {}
  220. /**
  221. * @tentative-return-type
  222. * @alias date_isodate_set
  223. */
  224. public function setISODate(int $year, int $week, int $dayOfWeek = 1): DateTime {}
  225. /**
  226. * @tentative-return-type
  227. * @alias date_timestamp_set
  228. */
  229. public function setTimestamp(int $timestamp): DateTime {}
  230. /**
  231. * @tentative-return-type
  232. * @alias date_timestamp_get
  233. */
  234. public function getTimestamp(): int {}
  235. /**
  236. * @tentative-return-type
  237. * @alias date_diff
  238. */
  239. public function diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval {}
  240. }
  241. class DateTimeImmutable implements DateTimeInterface
  242. {
  243. public function __construct(string $datetime = "now", ?DateTimeZone $timezone = null) {}
  244. /** @tentative-return-type */
  245. public function __wakeup(): void {}
  246. /** @tentative-return-type */
  247. public static function __set_state(array $array): DateTimeImmutable {}
  248. /**
  249. * @tentative-return-type
  250. * @alias date_create_immutable_from_format
  251. */
  252. public static function createFromFormat(string $format, string $datetime, ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
  253. /**
  254. * @return array<string, int|array>|false
  255. * @tentative-return-type
  256. * @alias date_get_last_errors
  257. */
  258. public static function getLastErrors(): array|false {}
  259. /**
  260. * @tentative-return-type
  261. * @alias date_format
  262. */
  263. public function format(string $format): string {}
  264. /**
  265. * @tentative-return-type
  266. * @alias date_timezone_get
  267. */
  268. public function getTimezone(): DateTimeZone|false {}
  269. /**
  270. * @tentative-return-type
  271. * @alias date_offset_get
  272. */
  273. public function getOffset(): int {}
  274. /**
  275. * @tentative-return-type
  276. * @alias date_timestamp_get
  277. */
  278. public function getTimestamp(): int {}
  279. /**
  280. * @tentative-return-type
  281. * @alias date_diff
  282. */
  283. public function diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval {}
  284. /** @tentative-return-type */
  285. public function modify(string $modifier): DateTimeImmutable|false {}
  286. /** @tentative-return-type */
  287. public function add(DateInterval $interval): DateTimeImmutable {}
  288. /** @tentative-return-type */
  289. public function sub(DateInterval $interval): DateTimeImmutable {}
  290. /** @tentative-return-type */
  291. public function setTimezone(DateTimeZone $timezone): DateTimeImmutable {}
  292. /** @tentative-return-type */
  293. public function setTime(int $hour, int $minute, int $second = 0, int $microsecond = 0): DateTimeImmutable {}
  294. /** @tentative-return-type */
  295. public function setDate(int $year, int $month, int $day): DateTimeImmutable {}
  296. /** @tentative-return-type */
  297. public function setISODate(int $year, int $week, int $dayOfWeek = 1): DateTimeImmutable {}
  298. /** @tentative-return-type */
  299. public function setTimestamp(int $timestamp): DateTimeImmutable {}
  300. /** @tentative-return-type */
  301. public static function createFromMutable(DateTime $object): DateTimeImmutable {}
  302. public static function createFromInterface(DateTimeInterface $object): DateTimeImmutable {}
  303. }
  304. class DateTimeZone
  305. {
  306. public function __construct(string $timezone) {}
  307. /**
  308. * @tentative-return-type
  309. * @alias timezone_name_get
  310. */
  311. public function getName(): string {}
  312. /**
  313. * @tentative-return-type
  314. * @alias timezone_offset_get
  315. */
  316. public function getOffset(DateTimeInterface $datetime): int {}
  317. /**
  318. * @return array<int, array>|false
  319. * @tentative-return-type
  320. * @alias timezone_transitions_get
  321. */
  322. public function getTransitions(int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX): array|false {}
  323. /**
  324. * @return array<string, float|string>|false
  325. * @tentative-return-type
  326. * @alias timezone_location_get
  327. */
  328. public function getLocation(): array|false {}
  329. /**
  330. * @return array<string, array>
  331. * @tentative-return-type
  332. * @alias timezone_abbreviations_list
  333. */
  334. public static function listAbbreviations(): array {}
  335. /**
  336. * @return array<int, string>
  337. * @tentative-return-type
  338. * @alias timezone_identifiers_list
  339. */
  340. public static function listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array {}
  341. /** @tentative-return-type */
  342. public function __wakeup(): void {}
  343. /** @tentative-return-type */
  344. public static function __set_state(array $array): DateTimeZone {}
  345. }
  346. class DateInterval
  347. {
  348. public function __construct(string $duration) {}
  349. /**
  350. * @tentative-return-type
  351. * @alias date_interval_create_from_date_string
  352. */
  353. public static function createFromDateString(string $datetime): DateInterval|false {}
  354. /**
  355. * @tentative-return-type
  356. * @alias date_interval_format
  357. */
  358. public function format(string $format): string {}
  359. /** @tentative-return-type */
  360. public function __wakeup(): void {}
  361. /** @tentative-return-type */
  362. public static function __set_state(array $array): DateInterval {}
  363. }
  364. class DatePeriod implements IteratorAggregate
  365. {
  366. /**
  367. * @param DateTimeInterface|string $start
  368. * @param DateInterval|int $interval
  369. * @param DateTimeInterface|int $end
  370. * @param int $options
  371. */
  372. public function __construct($start, $interval = UNKNOWN, $end = UNKNOWN, $options = UNKNOWN) {}
  373. /** @tentative-return-type */
  374. public function getStartDate(): DateTimeInterface {}
  375. /** @tentative-return-type */
  376. public function getEndDate(): ?DateTimeInterface {}
  377. /** @tentative-return-type */
  378. public function getDateInterval(): DateInterval {}
  379. /** @tentative-return-type */
  380. public function getRecurrences(): ?int {}
  381. /** @tentative-return-type */
  382. public function __wakeup(): void {}
  383. /** @tentative-return-type */
  384. public static function __set_state(array $array): DatePeriod {}
  385. public function getIterator(): Iterator {}
  386. }