diff options
author | Dmitry Stogov <dmitry@zend.com> | 2015-01-28 06:56:19 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2015-01-28 06:56:19 +0300 |
commit | 638d0cb7531525201e00577d5a77f1da3f84811e (patch) | |
tree | 79d288d48c40d0aa720158d43b053145b8c9fe73 /ext/reflection/php_reflection.c | |
parent | 598c935245eca96ce93d1cc112cd8bbd1cf412c9 (diff) | |
parent | c8576c5a46508ce87f7d2eb2442e6a9283b6a1ce (diff) | |
download | php-git-638d0cb7531525201e00577d5a77f1da3f84811e.tar.gz |
Merge branch 'typed_returns' of github.com:morrisonlevi/php-src into test
* 'typed_returns' of github.com:morrisonlevi/php-src:
Implement return types
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index c95ec0d81e..5dddd05cea 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -907,6 +907,24 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry } _function_parameter_string(str, fptr, param_indent.buf->val); string_free(¶m_indent); + if (fptr->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { + string_printf(str, " %s- Return [ ", indent); + if (fptr->common.arg_info[-1].class_name) { + string_printf(str, "%s ", + (fptr->type == ZEND_INTERNAL_FUNCTION) ? + ((zend_internal_arg_info*)(fptr->common.arg_info - 1))->class_name : + fptr->common.arg_info[-1].class_name->val); + if (fptr->common.arg_info[-1].allow_null) { + string_printf(str, "or NULL "); + } + } else if (fptr->common.arg_info[-1].type_hint) { + string_printf(str, "%s ", zend_get_type_by_const(fptr->common.arg_info[-1].type_hint)); + if (fptr->common.arg_info[-1].allow_null) { + string_printf(str, "or NULL "); + } + } + string_printf(str, "]\n"); + } string_printf(str, "%s}\n", indent); } /* }}} */ |