Skip to content

Commit bdf2cd7

Browse files
committed
Move isBuiltin() method from ReflectionType to ReflectionNamedType
This method only makes sense for single types, e.g. it would be meaningless for union types. Note that we always return ReflectionNamedType right now, so this does not break compatibility for code using any currently existing types.
1 parent 603b9c4 commit bdf2cd7

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

ext/reflection/php_reflection.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2817,22 +2817,6 @@ ZEND_METHOD(reflection_type, allowsNull)
28172817
}
28182818
/* }}} */
28192819

2820-
/* {{{ proto public bool ReflectionType::isBuiltin()
2821-
Returns whether parameter is a builtin type */
2822-
ZEND_METHOD(reflection_type, isBuiltin)
2823-
{
2824-
reflection_object *intern;
2825-
type_reference *param;
2826-
2827-
if (zend_parse_parameters_none() == FAILURE) {
2828-
return;
2829-
}
2830-
GET_REFLECTION_OBJECT_PTR(param);
2831-
2832-
RETVAL_BOOL(ZEND_TYPE_IS_CODE(param->type));
2833-
}
2834-
/* }}} */
2835-
28362820
/* {{{ reflection_type_name */
28372821
static zend_string *reflection_type_name(type_reference *param) {
28382822
if (ZEND_TYPE_IS_NAME(param->type)) {
@@ -2863,7 +2847,7 @@ ZEND_METHOD(reflection_type, __toString)
28632847
/* }}} */
28642848

28652849
/* {{{ proto public string ReflectionNamedType::getName()
2866-
Return the text of the type hint */
2850+
Return the name of the type */
28672851
ZEND_METHOD(reflection_named_type, getName)
28682852
{
28692853
reflection_object *intern;
@@ -2878,6 +2862,22 @@ ZEND_METHOD(reflection_named_type, getName)
28782862
}
28792863
/* }}} */
28802864

2865+
/* {{{ proto public bool ReflectionNamedType::isBuiltin()
2866+
Returns whether type is a builtin type */
2867+
ZEND_METHOD(reflection_named_type, isBuiltin)
2868+
{
2869+
reflection_object *intern;
2870+
type_reference *param;
2871+
2872+
if (zend_parse_parameters_none() == FAILURE) {
2873+
return;
2874+
}
2875+
GET_REFLECTION_OBJECT_PTR(param);
2876+
2877+
RETVAL_BOOL(ZEND_TYPE_IS_CODE(param->type));
2878+
}
2879+
/* }}} */
2880+
28812881
/* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name [, bool return]) throws ReflectionException
28822882
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
28832883
ZEND_METHOD(reflection_method, export)
@@ -6645,13 +6645,13 @@ static const zend_function_entry reflection_parameter_functions[] = {
66456645
static const zend_function_entry reflection_type_functions[] = {
66466646
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
66476647
ZEND_ME(reflection_type, allowsNull, arginfo_reflection__void, 0)
6648-
ZEND_ME(reflection_type, isBuiltin, arginfo_reflection__void, 0)
66496648
ZEND_ME(reflection_type, __toString, arginfo_reflection__void, ZEND_ACC_DEPRECATED)
66506649
PHP_FE_END
66516650
};
66526651

66536652
static const zend_function_entry reflection_named_type_functions[] = {
66546653
ZEND_ME(reflection_named_type, getName, arginfo_reflection__void, 0)
6654+
ZEND_ME(reflection_named_type, isBuiltin, arginfo_reflection__void, 0)
66556655
PHP_FE_END
66566656
};
66576657

0 commit comments

Comments
 (0)