@@ -2434,6 +2434,48 @@ ZEND_METHOD(reflection_parameter, getClass)
2434
2434
}
2435
2435
/* }}} */
2436
2436
2437
+ /* {{{ proto public bool ReflectionParameter::hasTypehint()
2438
+ Rethern whether parameter has a type hint */
2439
+ ZEND_METHOD (reflection_parameter , hasTypehint )
2440
+ {
2441
+ reflection_object * intern ;
2442
+ parameter_reference * param ;
2443
+
2444
+ if (zend_parse_parameters_none () == FAILURE ) {
2445
+ return ;
2446
+ }
2447
+ GET_REFLECTION_OBJECT_PTR (param );
2448
+
2449
+ RETVAL_BOOL (param -> arg_info -> type_hint != 0 );
2450
+ }
2451
+ /* }}} */
2452
+
2453
+ /* {{{ proto public string ReflectionParameter::getTypehintText()
2454
+ Returns the typehint associated with the parameter */
2455
+ ZEND_METHOD (reflection_parameter , getTypehintText )
2456
+ {
2457
+ reflection_object * intern ;
2458
+ parameter_reference * param ;
2459
+
2460
+ if (zend_parse_parameters_none () == FAILURE ) {
2461
+ return ;
2462
+ }
2463
+ GET_REFLECTION_OBJECT_PTR (param );
2464
+
2465
+ switch (param -> arg_info -> type_hint ) {
2466
+ case IS_ARRAY :
2467
+ RETURN_STRINGL ("array" , sizeof ("array" ) - 1 , 1 );
2468
+ case IS_CALLABLE :
2469
+ RETURN_STRINGL ("callable" , sizeof ("callable" ) - 1 , 1 );
2470
+ case IS_OBJECT :
2471
+ RETURN_STRINGL (param -> arg_info -> class_name ,
2472
+ param -> arg_info -> class_name_len , 1 );
2473
+ default :
2474
+ RETURN_EMPTY_STRING ();
2475
+ }
2476
+ }
2477
+ /* }}} */
2478
+
2437
2479
/* {{{ proto public bool ReflectionParameter::isArray()
2438
2480
Returns whether parameter MUST be an array */
2439
2481
ZEND_METHOD (reflection_parameter , isArray )
@@ -6026,6 +6068,8 @@ static const zend_function_entry reflection_parameter_functions[] = {
6026
6068
ZEND_ME (reflection_parameter , getDeclaringFunction , arginfo_reflection__void , 0 )
6027
6069
ZEND_ME (reflection_parameter , getDeclaringClass , arginfo_reflection__void , 0 )
6028
6070
ZEND_ME (reflection_parameter , getClass , arginfo_reflection__void , 0 )
6071
+ ZEND_ME (reflection_parameter , hasTypehint , arginfo_reflection__void , 0 )
6072
+ ZEND_ME (reflection_parameter , getTypehintText , arginfo_reflection__void , 0 )
6029
6073
ZEND_ME (reflection_parameter , isArray , arginfo_reflection__void , 0 )
6030
6074
ZEND_ME (reflection_parameter , isCallable , arginfo_reflection__void , 0 )
6031
6075
ZEND_ME (reflection_parameter , allowsNull , arginfo_reflection__void , 0 )
0 commit comments