summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-09-20 15:33:56 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-09-23 15:40:03 +0200
commit8d7911ef56be0e6c54e7716fdf467ab16703b1c7 (patch)
treea4f2e6762427f56981e147be265df750cdc30132 /ext/reflection/php_reflection.c
parent9e8ba7891e74a80265e09ff5b810ec947680c1ce (diff)
downloadphp-git-8d7911ef56be0e6c54e7716fdf467ab16703b1c7.tar.gz
Standardize type printing in reflection
Use ?T instead of "T or NULL".
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 18e3a0cecc..6273c56def 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -583,12 +583,8 @@ static void _parameter_string(smart_str *str, zend_function *fptr, struct _zend_
smart_str_append_printf(str, "<required> ");
}
if (ZEND_TYPE_IS_SET(arg_info->type)) {
- /* TODO: We should be using ?Type instead of "or NULL" here. */
- zend_string *type_str = zend_type_to_string(ZEND_TYPE_WITHOUT_NULL(arg_info->type));
+ zend_string *type_str = zend_type_to_string(arg_info->type);
smart_str_append_printf(str, "%s ", ZSTR_VAL(type_str));
- if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- smart_str_append_printf(str, "or NULL ");
- }
zend_string_release(type_str);
}
if (arg_info->pass_by_reference) {
@@ -800,13 +796,8 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent
if (fptr->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
smart_str_append_printf(str, " %s- Return [ ", indent);
if (ZEND_TYPE_IS_SET(fptr->common.arg_info[-1].type)) {
- /* TODO: We should use ?Type instead of "or NULL" here */
- zend_string *type_str =
- zend_type_to_string(ZEND_TYPE_WITHOUT_NULL(fptr->common.arg_info[-1].type));
+ zend_string *type_str = zend_type_to_string(fptr->common.arg_info[-1].type);
smart_str_append_printf(str, "%s ", ZSTR_VAL(type_str));
- if (ZEND_TYPE_ALLOW_NULL(fptr->common.arg_info[-1].type)) {
- smart_str_appends(str, "or NULL ");
- }
zend_string_release(type_str);
}
smart_str_appends(str, "]\n");