mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/reflection: voidify format_default_value() (#19234)
This function always returned SUCCESS unconditionally; removing the return type revealed some impossible code for handling FAILURE that could also be removed.
This commit is contained in:
@@ -716,7 +716,7 @@ static zval *get_default_from_recv(zend_op_array *op_array, uint32_t offset) {
|
|||||||
return RT_CONSTANT(recv, recv->op2);
|
return RT_CONSTANT(recv, recv->op2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int format_default_value(smart_str *str, zval *value) {
|
static void format_default_value(smart_str *str, zval *value) {
|
||||||
if (smart_str_append_zval(str, value, SIZE_MAX) == SUCCESS) {
|
if (smart_str_append_zval(str, value, SIZE_MAX) == SUCCESS) {
|
||||||
/* Nothing to do. */
|
/* Nothing to do. */
|
||||||
} else if (Z_TYPE_P(value) == IS_ARRAY) {
|
} else if (Z_TYPE_P(value) == IS_ARRAY) {
|
||||||
@@ -761,7 +761,6 @@ static int format_default_value(smart_str *str, zval *value) {
|
|||||||
smart_str_append(str, ast_str);
|
smart_str_append(str, ast_str);
|
||||||
zend_string_release(ast_str);
|
zend_string_release(ast_str);
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool has_internal_arg_info(const zend_function *fptr) {
|
static inline bool has_internal_arg_info(const zend_function *fptr) {
|
||||||
@@ -808,9 +807,7 @@ static void _parameter_string(smart_str *str, zend_function *fptr, struct _zend_
|
|||||||
zval *default_value = get_default_from_recv((zend_op_array*)fptr, offset);
|
zval *default_value = get_default_from_recv((zend_op_array*)fptr, offset);
|
||||||
if (default_value) {
|
if (default_value) {
|
||||||
smart_str_appends(str, " = ");
|
smart_str_appends(str, " = ");
|
||||||
if (format_default_value(str, default_value) == FAILURE) {
|
format_default_value(str, default_value);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1055,9 +1052,7 @@ static void _property_string(smart_str *str, zend_property_info *prop, const cha
|
|||||||
zval *default_value = property_get_default(prop);
|
zval *default_value = property_get_default(prop);
|
||||||
if (default_value && !Z_ISUNDEF_P(default_value)) {
|
if (default_value && !Z_ISUNDEF_P(default_value)) {
|
||||||
smart_str_appends(str, " = ");
|
smart_str_appends(str, " = ");
|
||||||
if (format_default_value(str, default_value) == FAILURE) {
|
format_default_value(str, default_value);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7181,10 +7176,7 @@ ZEND_METHOD(ReflectionAttribute, __toString)
|
|||||||
smart_str_appends(&str, " = ");
|
smart_str_appends(&str, " = ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format_default_value(&str, &attr->data->args[i].value) == FAILURE) {
|
format_default_value(&str, &attr->data->args[i].value);
|
||||||
smart_str_free(&str);
|
|
||||||
RETURN_THROWS();
|
|
||||||
}
|
|
||||||
|
|
||||||
smart_str_appends(&str, " ]\n");
|
smart_str_appends(&str, " ]\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user