From 1a7234132850e750a167cc6195498be895b4f5aa Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 26 May 2005 13:46:17 +0000 Subject: Added array type hinting. (This patch requires full re-make) --- Zend/zend_reflection_api.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Zend/zend_reflection_api.c') diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index aeee738af8..050744b6b5 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -519,6 +519,11 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg if (arg_info->allow_null) { string_printf(str, "or NULL "); } + } else if (arg_info->array_type_hint) { + string_printf(str, "array "); + if (arg_info->allow_null) { + string_printf(str, "or NULL "); + } } if (arg_info->pass_by_reference) { string_write(str, "&", sizeof("&")-1); @@ -1716,6 +1721,20 @@ ZEND_METHOD(reflection_parameter, getClass) } /* }}} */ +/* {{{ proto public bool ReflectionParameter::isArray() + Returns whether parameter MUST be an array */ +ZEND_METHOD(reflection_parameter, isArray) +{ + reflection_object *intern; + parameter_reference *param; + + METHOD_NOTSTATIC_NUMPARAMS(0); + GET_REFLECTION_OBJECT_PTR(param); + + RETVAL_BOOL(param->arg_info->array_type_hint); +} +/* }}} */ + /* {{{ proto public bool ReflectionParameter::allowsNull() Returns whether NULL is allowed as this parameters's value */ ZEND_METHOD(reflection_parameter, allowsNull) @@ -3852,6 +3871,7 @@ static zend_function_entry reflection_parameter_functions[] = { ZEND_ME(reflection_parameter, getName, NULL, 0) ZEND_ME(reflection_parameter, isPassedByReference, NULL, 0) ZEND_ME(reflection_parameter, getClass, NULL, 0) + ZEND_ME(reflection_parameter, isArray, NULL, 0) ZEND_ME(reflection_parameter, allowsNull, NULL, 0) ZEND_ME(reflection_parameter, isOptional, NULL, 0) ZEND_ME(reflection_parameter, isDefaultValueAvailable, NULL, 0) -- cgit v1.2.1