diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-02 14:55:04 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-02 14:59:31 +0200 |
commit | bdf2cd75087be0cd7f6c79bee1e93ddcd36b2ac4 (patch) | |
tree | eccacd2b561294e93f190323a7ba6d8c26789b49 /ext/reflection/php_reflection.c | |
parent | 603b9c43cb993e6a744fda3bbed7c4617807f428 (diff) | |
download | php-git-bdf2cd75087be0cd7f6c79bee1e93ddcd36b2ac4.tar.gz |
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.
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 36 |
1 files changed, 18 insertions, 18 deletions
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 }; |