From bdf2cd75087be0cd7f6c79bee1e93ddcd36b2ac4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 2 Sep 2019 14:55:04 +0200 Subject: 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. --- ext/reflection/php_reflection.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'ext/reflection/php_reflection.c') diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 5f7dd80435..d31a99bd3f 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2817,22 +2817,6 @@ ZEND_METHOD(reflection_type, allowsNull) } /* }}} */ -/* {{{ proto public bool ReflectionType::isBuiltin() - Returns whether parameter is a builtin type */ -ZEND_METHOD(reflection_type, isBuiltin) -{ - reflection_object *intern; - type_reference *param; - - if (zend_parse_parameters_none() == FAILURE) { - return; - } - GET_REFLECTION_OBJECT_PTR(param); - - RETVAL_BOOL(ZEND_TYPE_IS_CODE(param->type)); -} -/* }}} */ - /* {{{ reflection_type_name */ static zend_string *reflection_type_name(type_reference *param) { if (ZEND_TYPE_IS_NAME(param->type)) { @@ -2863,7 +2847,7 @@ ZEND_METHOD(reflection_type, __toString) /* }}} */ /* {{{ proto public string ReflectionNamedType::getName() - Return the text of the type hint */ + Return the name of the type */ ZEND_METHOD(reflection_named_type, getName) { reflection_object *intern; @@ -2878,6 +2862,22 @@ ZEND_METHOD(reflection_named_type, getName) } /* }}} */ +/* {{{ proto public bool ReflectionNamedType::isBuiltin() + Returns whether type is a builtin type */ +ZEND_METHOD(reflection_named_type, isBuiltin) +{ + reflection_object *intern; + type_reference *param; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + GET_REFLECTION_OBJECT_PTR(param); + + RETVAL_BOOL(ZEND_TYPE_IS_CODE(param->type)); +} +/* }}} */ + /* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_method, export) @@ -6645,13 +6645,13 @@ static const zend_function_entry reflection_parameter_functions[] = { static const zend_function_entry reflection_type_functions[] = { ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) ZEND_ME(reflection_type, allowsNull, arginfo_reflection__void, 0) - ZEND_ME(reflection_type, isBuiltin, arginfo_reflection__void, 0) ZEND_ME(reflection_type, __toString, arginfo_reflection__void, ZEND_ACC_DEPRECATED) PHP_FE_END }; static const zend_function_entry reflection_named_type_functions[] = { ZEND_ME(reflection_named_type, getName, arginfo_reflection__void, 0) + ZEND_ME(reflection_named_type, isBuiltin, arginfo_reflection__void, 0) PHP_FE_END }; -- cgit v1.2.1