summaryrefslogtreecommitdiff
path: root/Zend/zend_inheritance.c
diff options
context:
space:
mode:
authorLevi Morrison <levim@php.net>2016-04-28 15:26:57 -0600
committerLevi Morrison <levim@php.net>2016-05-05 11:53:32 -0600
commit9662259cb93ff04be80766bdade39d2e827e0e16 (patch)
tree6dbc991b00567eb964f4b11db90b34bc03705ee9 /Zend/zend_inheritance.c
parent49fe737e585d2bf3cea4df14ef7a1965dc632655 (diff)
downloadphp-git-9662259cb93ff04be80766bdade39d2e827e0e16.tar.gz
Add nullable parameter types
This works off of Dmitry's commit for nullable return types
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r--Zend/zend_inheritance.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index df7dbfd63e..de9b63e342 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -355,6 +355,11 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
static ZEND_COLD void zend_append_type_hint(smart_str *str, const zend_function *fptr, zend_arg_info *arg_info, int return_hint) /* {{{ */
{
+
+ if (arg_info->type_hint != IS_UNDEF && arg_info->allow_null) {
+ smart_str_appendc(str, '?');
+ }
+
if (arg_info->class_name) {
const char *class_name;
size_t class_name_len;
@@ -495,8 +500,6 @@ static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function
} else {
smart_str_appends(&str, "NULL");
}
- } else if (arg_info->type_hint && arg_info->allow_null) {
- smart_str_appends(&str, " = NULL");
}
if (++i < num_args) {
@@ -510,9 +513,6 @@ static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function
if (fptr->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
smart_str_appends(&str, ": ");
- if (fptr->common.arg_info[-1].allow_null) {
- smart_str_appendc(&str, '?');
- }
zend_append_type_hint(&str, fptr, fptr->common.arg_info - 1, 1);
}
smart_str_0(&str);