Skip to content

Commit 2d248c8

Browse files
authored
Generate optimizer func info from stubs for ext/date (#7403)
1 parent 0f3d4b5 commit 2d248c8

File tree

4 files changed

+100
-37
lines changed

4 files changed

+100
-37
lines changed

Zend/Optimizer/zend_func_info.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -341,38 +341,6 @@ static const func_info_t old_func_infos[] = {
341341
F1("stream_bucket_new", MAY_BE_OBJECT),
342342
F1("sys_get_temp_dir", MAY_BE_STRING),
343343

344-
/* ext/date */
345-
F1("date", MAY_BE_STRING),
346-
F1("gmdate", MAY_BE_STRING),
347-
F1("strftime", MAY_BE_FALSE | MAY_BE_STRING),
348-
F1("gmstrftime", MAY_BE_FALSE | MAY_BE_STRING),
349-
F1("localtime", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
350-
F1("getdate", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
351-
F1("date_create", MAY_BE_FALSE | MAY_BE_OBJECT),
352-
F1("date_create_immutable", MAY_BE_FALSE | MAY_BE_OBJECT),
353-
F1("date_create_from_format", MAY_BE_FALSE | MAY_BE_OBJECT),
354-
F1("date_create_immutable_from_format", MAY_BE_FALSE | MAY_BE_OBJECT),
355-
F1("date_parse", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
356-
F1("date_parse_from_format", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
357-
F1("date_get_last_errors", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_ARRAY),
358-
F1("date_format", MAY_BE_STRING),
359-
F1("date_timezone_get", MAY_BE_FALSE | MAY_BE_OBJECT),
360-
F1("date_diff", MAY_BE_OBJECT),
361-
F1("timezone_open", MAY_BE_FALSE | MAY_BE_OBJECT),
362-
F1("timezone_name_get", MAY_BE_STRING),
363-
F1("timezone_name_from_abbr", MAY_BE_FALSE | MAY_BE_STRING),
364-
F1("timezone_transitions_get", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
365-
F1("timezone_location_get", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING),
366-
F1("timezone_identifiers_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
367-
F1("timezone_abbreviations_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
368-
F1("timezone_version_get", MAY_BE_STRING),
369-
F1("date_interval_create_from_date_string", MAY_BE_FALSE | MAY_BE_OBJECT),
370-
F1("date_interval_format", MAY_BE_STRING),
371-
F1("date_default_timezone_get", MAY_BE_STRING),
372-
F1("date_sunrise", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING),
373-
F1("date_sunset", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING),
374-
F1("date_sun_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG),
375-
376344
/* ext/preg */
377345
FN("preg_replace", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
378346
FN("preg_replace_callback", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),

Zend/Optimizer/zend_func_infos.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,36 @@ static const func_info_t func_infos[] = {
2727
FN("socket_export_stream", MAY_BE_RESOURCE|MAY_BE_FALSE),
2828
FN("dba_popen", MAY_BE_RESOURCE|MAY_BE_FALSE),
2929
FN("dba_open", MAY_BE_RESOURCE|MAY_BE_FALSE),
30+
F1("date", MAY_BE_STRING),
31+
F1("gmdate", MAY_BE_STRING),
32+
F1("strftime", MAY_BE_STRING|MAY_BE_FALSE),
33+
F1("gmstrftime", MAY_BE_STRING|MAY_BE_FALSE),
34+
F1("localtime", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG),
35+
F1("getdate", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING),
36+
F1("date_create", MAY_BE_OBJECT|MAY_BE_FALSE),
37+
F1("date_create_immutable", MAY_BE_OBJECT|MAY_BE_FALSE),
38+
F1("date_create_from_format", MAY_BE_OBJECT|MAY_BE_FALSE),
39+
F1("date_create_immutable_from_format", MAY_BE_OBJECT|MAY_BE_FALSE),
40+
F1("date_parse", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY),
41+
F1("date_parse_from_format", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY),
42+
F1("date_get_last_errors", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
43+
F1("date_format", MAY_BE_STRING),
44+
F1("date_timezone_get", MAY_BE_OBJECT|MAY_BE_FALSE),
45+
F1("date_diff", MAY_BE_OBJECT),
46+
F1("timezone_open", MAY_BE_OBJECT|MAY_BE_FALSE),
47+
F1("timezone_name_get", MAY_BE_STRING),
48+
F1("timezone_name_from_abbr", MAY_BE_STRING|MAY_BE_FALSE),
49+
F1("timezone_transitions_get", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
50+
F1("timezone_location_get", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_DOUBLE|MAY_BE_ARRAY_OF_STRING),
51+
F1("timezone_identifiers_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
52+
F1("timezone_abbreviations_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ARRAY),
53+
F1("timezone_version_get", MAY_BE_STRING),
54+
F1("date_interval_create_from_date_string", MAY_BE_OBJECT|MAY_BE_FALSE),
55+
F1("date_interval_format", MAY_BE_STRING),
56+
F1("date_default_timezone_get", MAY_BE_STRING),
57+
F1("date_sunrise", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE),
58+
F1("date_sunset", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE),
59+
F1("date_sun_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_ARRAY_OF_TRUE|MAY_BE_ARRAY_OF_LONG),
3060
FN("bzopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
3161
F1("gzopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
3262
#if HAVE_NANOSLEEP

ext/date/php_date.stub.php

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
function strtotime(string $datetime, ?int $baseTimestamp = null): int|false {}
66

7+
/** @refcount 1 */
78
function date(string $format, ?int $timestamp = null): string {}
89

910
function idate(string $format, ?int $timestamp = null): int|false {}
1011

12+
/** @refcount 1 */
1113
function gmdate(string $format, ?int $timestamp = null): string {}
1214

1315
function mktime(
@@ -20,35 +22,66 @@ function gmmktime(
2022

2123
function checkdate(int $month, int $day, int $year): bool {}
2224

23-
/** @deprecated */
25+
/**
26+
* @refcount 1
27+
* @deprecated
28+
*/
2429
function strftime(string $format, ?int $timestamp = null): string|false {}
2530

26-
/** @deprecated */
31+
/**
32+
* @refcount 1
33+
* @deprecated
34+
*/
2735
function gmstrftime(string $format, ?int $timestamp = null): string|false {}
2836

2937
function time(): int {}
3038

39+
/**
40+
* @return array<int|string, int>
41+
* @refcount 1
42+
*/
3143
function localtime(?int $timestamp = null, bool $associative = false): array {}
3244

45+
/**
46+
* @return array<int|string, int|string>
47+
* @refcount 1
48+
*/
3349
function getdate(?int $timestamp = null): array {}
3450

51+
/** @refcount 1 */
3552
function date_create(string $datetime = "now", ?DateTimeZone $timezone = null): DateTime|false {}
3653

54+
/** @refcount 1 */
3755
function date_create_immutable(
3856
string $datetime = "now", ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
3957

58+
/** @refcount 1 */
4059
function date_create_from_format(
4160
string $format, string $datetime, ?DateTimeZone $timezone = null): DateTime|false {}
4261

62+
/** @refcount 1 */
4363
function date_create_immutable_from_format(
4464
string $format, string $datetime, ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
4565

66+
/**
67+
* @return array<string, mixed>
68+
* @refcount 1
69+
*/
4670
function date_parse(string $datetime): array {}
4771

72+
/**
73+
* @return array<string, mixed>
74+
* @refcount 1
75+
*/
4876
function date_parse_from_format(string $format, string $datetime): array {}
4977

78+
/**
79+
* @return array<string, int|array>|false
80+
* @refcount 1
81+
*/
5082
function date_get_last_errors(): array|false {}
5183

84+
/** @refcount 1 */
5285
function date_format(DateTimeInterface $object, string $format): string {}
5386

5487
function date_modify(DateTime $object, string $modifier): DateTime|false {}
@@ -57,12 +90,14 @@ function date_add(DateTime $object, DateInterval $interval): DateTime {}
5790

5891
function date_sub(DateTime $object, DateInterval $interval): DateTime {}
5992

93+
/** @refcount 1 */
6094
function date_timezone_get(DateTimeInterface $object): DateTimeZone|false {}
6195

6296
function date_timezone_set(DateTime $object, DateTimeZone $timezone): DateTime {}
6397

6498
function date_offset_get(DateTimeInterface $object): int {}
6599

100+
/** @refcount 1 */
66101
function date_diff(
67102
DateTimeInterface $baseObject, DateTimeInterface $targetObject, bool $absolute = false): DateInterval {}
68103

@@ -77,45 +112,75 @@ function date_timestamp_set(DateTime $object, int $timestamp): DateTime {}
77112

78113
function date_timestamp_get(DateTimeInterface $object): int {}
79114

115+
/** @refcount 1 */
80116
function timezone_open(string $timezone): DateTimeZone|false {}
81117

118+
/** @refcount 1 */
82119
function timezone_name_get(DateTimeZone $object): string {}
83120

121+
/** @refcount 1 */
84122
function timezone_name_from_abbr(string $abbr, int $utcOffset = -1, int $isDST = -1): string|false {}
85123

86124
function timezone_offset_get(DateTimeZone $object, DateTimeInterface $datetime): int {}
87125

126+
/** @refcount 1 */
88127
function timezone_transitions_get(
89128
DateTimeZone $object, int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX): array|false {}
90129

130+
/**
131+
* @return array<string, float|string>
132+
* @refcount 1
133+
*/
91134
function timezone_location_get(DateTimeZone $object): array|false {}
92135

136+
/**
137+
* @return array<int, string>
138+
* @refcount 1
139+
*/
93140
function timezone_identifiers_list(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array {}
94141

142+
/**
143+
* @return array<string, array>
144+
* @refcount 1
145+
*/
95146
function timezone_abbreviations_list(): array {}
96147

148+
/** @refcount 1 */
97149
function timezone_version_get(): string {}
98150

151+
/** @refcount 1 */
99152
function date_interval_create_from_date_string(string $datetime): DateInterval|false {}
100153

154+
/** @refcount 1 */
101155
function date_interval_format(DateInterval $object, string $format): string {}
102156

103157
function date_default_timezone_set(string $timezoneId): bool {}
104158

159+
/** @refcount 1 */
105160
function date_default_timezone_get(): string {}
106161

107-
/** @deprecated */
162+
/**
163+
* @refcount 1
164+
* @deprecated
165+
*/
108166
function date_sunrise(
109167
int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING,
110168
?float $latitude = null, ?float $longitude = null, ?float $zenith = null,
111169
?float $utcOffset = null): string|int|float|false {}
112170

113-
/** @deprecated */
171+
/**
172+
* @refcount 1
173+
* @deprecated
174+
*/
114175
function date_sunset(
115176
int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING,
116177
?float $latitude = null, ?float $longitude = null, ?float $zenith = null,
117178
?float $utcOffset = null): string|int|float|false {}
118179

180+
/**
181+
* @return array<string, bool|int>
182+
* @refcount 1
183+
*/
119184
function date_sun_info(int $timestamp, float $latitude, float $longitude): array {}
120185

121186
interface DateTimeInterface

ext/date/php_date_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: bc0634c149cda640616f7ecd7e173a0d6497a911 */
2+
* Stub hash: 18e879f3036f0d9685dfe73e43c13ecdae2d93ee */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0)

0 commit comments

Comments
 (0)