mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Mention that arg_info[-1] holds the return info
I lost some time trying to know how to find the returned type. It's not that obvious it is stored in the _argument_ information array. For the sake of Internet, here is the full code checking that a function _has_ a returned type: ```c zend_function *function = /* e.g. fci_cache->function_handler */; if (!(function->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE)) { php_printf("no return type\n"); } else { php_printf("has a return type\n"); php_printf("return type = %s\n", zend_get_type_by_const(ZEND_TYPE_CODE(function->common.arg_info[-1].type))); } ```
This commit is contained in:
parent
fc4e73b383
commit
dce8d19fc1
1 changed files with 1 additions and 1 deletions
|
@ -483,7 +483,7 @@ union _zend_function {
|
|||
zend_function *prototype;
|
||||
uint32_t num_args;
|
||||
uint32_t required_num_args;
|
||||
zend_arg_info *arg_info;
|
||||
zend_arg_info *arg_info; /* index -1 represents the return value info, if any */
|
||||
} common;
|
||||
|
||||
zend_op_array op_array;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue