, ZEND_BEGIN_ARG_INFO_EX.
ZEND_BEGIN_ARG_INFO_EX - PHP 5, , , . arginfo , true:
ZEND_BEGIN_ARG_INFO_EX(arginfo_test, 0, 0, 3)
ZEND_ARG_INFO(0, firstArg)
ZEND_ARG_OBJ_INFO(0, objNonNull, stdClass, 0)
ZEND_ARG_OBJ_INFO(0, obj, stdClass, 1)
ZEND_ARG_OBJ_INFO(1, objByRef, stdClass, 1)
ZEND_END_ARG_INFO()
:
sample_with_types();
sample_with_types(1, null);
sample_with_types(1, new stdClass, null);
sample_with_types(1, new stdClass, 1);
sample_with_types(1, new stdClass, null, 2);
, :
$ref = new ReflectionFunction('sample_with_types');
var_dump($ref->getParameters());
... , :
array(4) {
[0]=>
&object(ReflectionParameter)#2 (1) {
["name"]=>
string(8) "firstArg"
}
[1]=>
&object(ReflectionParameter)#3 (1) {
["name"]=>
string(10) "objNonNull"
}
[2]=>
&object(ReflectionParameter)#4 (1) {
["name"]=>
string(3) "obj"
}
[3]=>
&object(ReflectionParameter)#5 (1) {
["name"]=>
string(8) "objByRef"
}
}
arginfo, ReflectionFunction::getParameters() .
- required_num_args , .
, , zend_parse_parameters, :
PHP_FUNCTION(sample_with_types)
{
long arg1;
zval *arg2 = NULL, *arg3 = NULL, *arg4 = NULL;
zend_class_entry ce2, ce3, ce4;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "looo", &arg1,
&arg2, &ce2, &arg3, &ce3, &arg4, &ce4) == FAILURE)
{
return;
}
RETURN_TRUE;
}
, "looo" ( ), "lOO!O!" ( ) . hinting arginfo, .
, arginfo:
zend_fetch_class .- .
- , .
- , .
, arginfo zend_parse_parameters.