]> granicus.if.org Git - php/commitdiff
Remove no longer necessary type-name special cases
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 4 Feb 2018 22:20:14 +0000 (23:20 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 4 Feb 2018 22:20:44 +0000 (23:20 +0100)
zend_get_type_by_name() now produces the correct value by itself,
so we no longer need these workarounds.

Zend/zend_inheritance.c
ext/reflection/php_reflection.c

index 76bc91a956619d315b9eb5b34748afbc8ed3e652..46a674ba903b8cfe0ba027d91dc1f289700b0ead 100644 (file)
@@ -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, ' ');
                }
index 6749003c46dd5b14c9f1eaf27ea44373849c9ed3..ee456d05f0040acfc85fcb6011f1e8ed0d2528f2 100644 (file)
@@ -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);
        }
 }
 /* }}} */