Skip to content

Commit b7ba089

Browse files
committed
Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs
1 parent e1b618e commit b7ba089

15 files changed

+442
-172
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*.[ch] diff=cpp
2121

2222
# Collapse generated files within git and pull request diff.
23-
**/*_arginfo.h linguist-generated -diff
2423
/Zend/zend_vm_execute.h linguist-generated -diff
2524
/Zend/zend_vm_handlers.h linguist-generated -diff
2625
/Zend/zend_vm_opcodes.[ch] linguist-generated -diff

Zend/zend_attributes_arginfo.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ static zend_class_entry *register_class_Attribute(void)
134134
zend_declare_typed_property(class_entry, property_flags_name, &property_flags_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
135135
zend_string_release(property_flags_name);
136136

137-
zend_string *attribute_name_Attribute_class_Attribute = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
138-
zend_attribute *attribute_Attribute_class_Attribute = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_Attribute, 1);
139-
zend_string_release(attribute_name_Attribute_class_Attribute);
140-
zval attribute_Attribute_class_Attribute_arg0;
141-
ZVAL_LONG(&attribute_Attribute_class_Attribute_arg0, ZEND_ATTRIBUTE_TARGET_CLASS);
142-
ZVAL_COPY_VALUE(&attribute_Attribute_class_Attribute->args[0].value, &attribute_Attribute_class_Attribute_arg0);
137+
zend_string *attribute_name_Attribute_class_Attribute_1 = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
138+
zend_attribute *attribute_Attribute_class_Attribute_1 = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_Attribute_1, 1);
139+
zend_string_release(attribute_name_Attribute_class_Attribute_1);
140+
zval attribute_Attribute_class_Attribute_1_arg0;
141+
ZVAL_LONG(&attribute_Attribute_class_Attribute_1_arg0, ZEND_ATTRIBUTE_TARGET_CLASS);
142+
ZVAL_COPY_VALUE(&attribute_Attribute_class_Attribute_1->args[0].value, &attribute_Attribute_class_Attribute_1_arg0);
143143

144144
return class_entry;
145145
}
@@ -152,12 +152,12 @@ static zend_class_entry *register_class_ReturnTypeWillChange(void)
152152
class_entry = zend_register_internal_class_ex(&ce, NULL);
153153
class_entry->ce_flags |= ZEND_ACC_FINAL;
154154

155-
zend_string *attribute_name_Attribute_class_ReturnTypeWillChange = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
156-
zend_attribute *attribute_Attribute_class_ReturnTypeWillChange = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_ReturnTypeWillChange, 1);
157-
zend_string_release(attribute_name_Attribute_class_ReturnTypeWillChange);
158-
zval attribute_Attribute_class_ReturnTypeWillChange_arg0;
159-
ZVAL_LONG(&attribute_Attribute_class_ReturnTypeWillChange_arg0, ZEND_ATTRIBUTE_TARGET_METHOD);
160-
ZVAL_COPY_VALUE(&attribute_Attribute_class_ReturnTypeWillChange->args[0].value, &attribute_Attribute_class_ReturnTypeWillChange_arg0);
155+
zend_string *attribute_name_Attribute_class_ReturnTypeWillChange_1 = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
156+
zend_attribute *attribute_Attribute_class_ReturnTypeWillChange_1 = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_ReturnTypeWillChange_1, 1);
157+
zend_string_release(attribute_name_Attribute_class_ReturnTypeWillChange_1);
158+
zval attribute_Attribute_class_ReturnTypeWillChange_1_arg0;
159+
ZVAL_LONG(&attribute_Attribute_class_ReturnTypeWillChange_1_arg0, ZEND_ATTRIBUTE_TARGET_METHOD);
160+
ZVAL_COPY_VALUE(&attribute_Attribute_class_ReturnTypeWillChange_1->args[0].value, &attribute_Attribute_class_ReturnTypeWillChange_1_arg0);
161161

162162
return class_entry;
163163
}
@@ -170,12 +170,12 @@ static zend_class_entry *register_class_AllowDynamicProperties(void)
170170
class_entry = zend_register_internal_class_ex(&ce, NULL);
171171
class_entry->ce_flags |= ZEND_ACC_FINAL;
172172

173-
zend_string *attribute_name_Attribute_class_AllowDynamicProperties = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
174-
zend_attribute *attribute_Attribute_class_AllowDynamicProperties = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_AllowDynamicProperties, 1);
175-
zend_string_release(attribute_name_Attribute_class_AllowDynamicProperties);
176-
zval attribute_Attribute_class_AllowDynamicProperties_arg0;
177-
ZVAL_LONG(&attribute_Attribute_class_AllowDynamicProperties_arg0, ZEND_ATTRIBUTE_TARGET_CLASS);
178-
ZVAL_COPY_VALUE(&attribute_Attribute_class_AllowDynamicProperties->args[0].value, &attribute_Attribute_class_AllowDynamicProperties_arg0);
173+
zend_string *attribute_name_Attribute_class_AllowDynamicProperties_1 = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
174+
zend_attribute *attribute_Attribute_class_AllowDynamicProperties_1 = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_AllowDynamicProperties_1, 1);
175+
zend_string_release(attribute_name_Attribute_class_AllowDynamicProperties_1);
176+
zval attribute_Attribute_class_AllowDynamicProperties_1_arg0;
177+
ZVAL_LONG(&attribute_Attribute_class_AllowDynamicProperties_1_arg0, ZEND_ATTRIBUTE_TARGET_CLASS);
178+
ZVAL_COPY_VALUE(&attribute_Attribute_class_AllowDynamicProperties_1->args[0].value, &attribute_Attribute_class_AllowDynamicProperties_1_arg0);
179179

180180
return class_entry;
181181
}
@@ -188,12 +188,12 @@ static zend_class_entry *register_class_SensitiveParameter(void)
188188
class_entry = zend_register_internal_class_ex(&ce, NULL);
189189
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
190190

191-
zend_string *attribute_name_Attribute_class_SensitiveParameter = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
192-
zend_attribute *attribute_Attribute_class_SensitiveParameter = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_SensitiveParameter, 1);
193-
zend_string_release(attribute_name_Attribute_class_SensitiveParameter);
194-
zval attribute_Attribute_class_SensitiveParameter_arg0;
195-
ZVAL_LONG(&attribute_Attribute_class_SensitiveParameter_arg0, ZEND_ATTRIBUTE_TARGET_PARAMETER);
196-
ZVAL_COPY_VALUE(&attribute_Attribute_class_SensitiveParameter->args[0].value, &attribute_Attribute_class_SensitiveParameter_arg0);
191+
zend_string *attribute_name_Attribute_class_SensitiveParameter_1 = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
192+
zend_attribute *attribute_Attribute_class_SensitiveParameter_1 = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_SensitiveParameter_1, 1);
193+
zend_string_release(attribute_name_Attribute_class_SensitiveParameter_1);
194+
zval attribute_Attribute_class_SensitiveParameter_1_arg0;
195+
ZVAL_LONG(&attribute_Attribute_class_SensitiveParameter_1_arg0, ZEND_ATTRIBUTE_TARGET_PARAMETER);
196+
ZVAL_COPY_VALUE(&attribute_Attribute_class_SensitiveParameter_1->args[0].value, &attribute_Attribute_class_SensitiveParameter_1_arg0);
197197

198198
return class_entry;
199199
}
@@ -223,12 +223,12 @@ static zend_class_entry *register_class_Override(void)
223223
class_entry = zend_register_internal_class_ex(&ce, NULL);
224224
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
225225

226-
zend_string *attribute_name_Attribute_class_Override = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
227-
zend_attribute *attribute_Attribute_class_Override = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_Override, 1);
228-
zend_string_release(attribute_name_Attribute_class_Override);
229-
zval attribute_Attribute_class_Override_arg0;
230-
ZVAL_LONG(&attribute_Attribute_class_Override_arg0, ZEND_ATTRIBUTE_TARGET_METHOD);
231-
ZVAL_COPY_VALUE(&attribute_Attribute_class_Override->args[0].value, &attribute_Attribute_class_Override_arg0);
226+
zend_string *attribute_name_Attribute_class_Override_1 = zend_string_init_interned("Attribute", sizeof("Attribute") - 1, 1);
227+
zend_attribute *attribute_Attribute_class_Override_1 = zend_add_class_attribute(class_entry, attribute_name_Attribute_class_Override_1, 1);
228+
zend_string_release(attribute_name_Attribute_class_Override_1);
229+
zval attribute_Attribute_class_Override_1_arg0;
230+
ZVAL_LONG(&attribute_Attribute_class_Override_1_arg0, ZEND_ATTRIBUTE_TARGET_METHOD);
231+
ZVAL_COPY_VALUE(&attribute_Attribute_class_Override_1->args[0].value, &attribute_Attribute_class_Override_1_arg0);
232232

233233
return class_entry;
234234
}

Zend/zend_builtin_functions_arginfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ static zend_class_entry *register_class_stdClass(void)
355355
class_entry = zend_register_internal_class_ex(&ce, NULL);
356356
class_entry->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
357357

358-
zend_string *attribute_name_AllowDynamicProperties_class_stdClass = zend_string_init_interned("AllowDynamicProperties", sizeof("AllowDynamicProperties") - 1, 1);
359-
zend_add_class_attribute(class_entry, attribute_name_AllowDynamicProperties_class_stdClass, 0);
360-
zend_string_release(attribute_name_AllowDynamicProperties_class_stdClass);
358+
zend_string *attribute_name_AllowDynamicProperties_class_stdClass_1 = zend_string_init_interned("AllowDynamicProperties", sizeof("AllowDynamicProperties") - 1, 1);
359+
zend_add_class_attribute(class_entry, attribute_name_AllowDynamicProperties_class_stdClass_1, 0);
360+
zend_string_release(attribute_name_AllowDynamicProperties_class_stdClass_1);
361361

362362
return class_entry;
363363
}

Zend/zend_exceptions_arginfo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static zend_class_entry *register_class_Exception(zend_class_entry *class_entry_
209209
zval property_message_default_value;
210210
ZVAL_EMPTY_STRING(&property_message_default_value);
211211
zend_string *property_message_name = zend_string_init("message", sizeof("message") - 1, 1);
212-
zend_declare_property_ex(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PROTECTED, NULL);
212+
zend_declare_typed_property(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PROTECTED, NULL, (zend_type) ZEND_TYPE_INIT_NONE(0));
213213
zend_string_release(property_message_name);
214214

215215
zval property_string_default_value;
@@ -221,7 +221,7 @@ static zend_class_entry *register_class_Exception(zend_class_entry *class_entry_
221221
zval property_code_default_value;
222222
ZVAL_LONG(&property_code_default_value, 0);
223223
zend_string *property_code_name = zend_string_init("code", sizeof("code") - 1, 1);
224-
zend_declare_property_ex(class_entry, property_code_name, &property_code_default_value, ZEND_ACC_PROTECTED, NULL);
224+
zend_declare_typed_property(class_entry, property_code_name, &property_code_default_value, ZEND_ACC_PROTECTED, NULL, (zend_type) ZEND_TYPE_INIT_NONE(0));
225225
zend_string_release(property_code_name);
226226

227227
zval property_file_default_value;
@@ -279,7 +279,7 @@ static zend_class_entry *register_class_Error(zend_class_entry *class_entry_Thro
279279
zval property_message_default_value;
280280
ZVAL_EMPTY_STRING(&property_message_default_value);
281281
zend_string *property_message_name = zend_string_init("message", sizeof("message") - 1, 1);
282-
zend_declare_property_ex(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PROTECTED, NULL);
282+
zend_declare_typed_property(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PROTECTED, NULL, (zend_type) ZEND_TYPE_INIT_NONE(0));
283283
zend_string_release(property_message_name);
284284

285285
zval property_string_default_value;
@@ -291,7 +291,7 @@ static zend_class_entry *register_class_Error(zend_class_entry *class_entry_Thro
291291
zval property_code_default_value;
292292
ZVAL_LONG(&property_code_default_value, 0);
293293
zend_string *property_code_name = zend_string_init("code", sizeof("code") - 1, 1);
294-
zend_declare_property_ex(class_entry, property_code_name, &property_code_default_value, ZEND_ACC_PROTECTED, NULL);
294+
zend_declare_typed_property(class_entry, property_code_name, &property_code_default_value, ZEND_ACC_PROTECTED, NULL, (zend_type) ZEND_TYPE_INIT_NONE(0));
295295
zend_string_release(property_code_name);
296296

297297
zval property_file_default_value;

0 commit comments

Comments
 (0)