From b4dff68379d8625f4895e74841683205d3fdd9ae Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 4 Feb 2018 23:20:14 +0100 Subject: [PATCH] Remove no longer necessary type-name special cases zend_get_type_by_name() now produces the correct value by itself, so we no longer need these workarounds. --- Zend/zend_inheritance.c | 10 ++-------- ext/reflection/php_reflection.c | 14 +++----------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 76bc91a956..46a674ba90 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -410,14 +410,8 @@ static ZEND_COLD void zend_append_type_hint(smart_str *str, const zend_function smart_str_appendc(str, ' '); } } else if (ZEND_TYPE_IS_CODE(arg_info->type)) { - if (ZEND_TYPE_CODE(arg_info->type) == IS_LONG) { - smart_str_appendl(str, "int", 3); - } else if (ZEND_TYPE_CODE(arg_info->type) == _IS_BOOL) { - smart_str_appendl(str, "bool", 4); - } else { - const char *type_name = zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)); - smart_str_appends(str, type_name); - } + const char *type_name = zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)); + smart_str_appends(str, type_name); if (!return_hint) { smart_str_appendc(str, ' '); } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 6749003c46..ee456d05f0 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2914,17 +2914,9 @@ ZEND_METHOD(reflection_type, isBuiltin) static zend_string *reflection_type_name(type_reference *param) { if (ZEND_TYPE_IS_CLASS(param->arg_info->type)) { return zend_string_copy(ZEND_TYPE_NAME(param->arg_info->type)); - } - switch (ZEND_TYPE_CODE(param->arg_info->type)) { - /* keep this for BC, bool vs boolean, int vs integer */ - case _IS_BOOL: return zend_string_init("bool", sizeof("bool") - 1, 0); - case IS_LONG: return zend_string_init("int", sizeof("int") - 1, 0); - /* use zend API for other types */ - default: - { - char *name = zend_get_type_by_const(ZEND_TYPE_CODE(param->arg_info->type)); - return zend_string_init(name, strlen(name), 0); - } + } else { + char *name = zend_get_type_by_const(ZEND_TYPE_CODE(param->arg_info->type)); + return zend_string_init(name, strlen(name), 0); } } /* }}} */ -- 2.50.1