From 8412de9da5304ca0ea287277c7e0d916e2c490be Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Thu, 28 Jan 2016 18:01:48 +0000 Subject: [PATCH] Support void return type in reflection --- ext/reflection/php_reflection.c | 1 + .../tests/ReflectionType_possible_types.phpt | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 ext/reflection/tests/ReflectionType_possible_types.phpt diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 461104f394..af1e972f60 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3029,6 +3029,7 @@ ZEND_METHOD(reflection_type, __toString) case _IS_BOOL: RETURN_STRINGL("bool", sizeof("bool") - 1); case IS_LONG: RETURN_STRINGL("int", sizeof("int") - 1); case IS_DOUBLE: RETURN_STRINGL("float", sizeof("float") - 1); + case IS_VOID: RETURN_STRINGL("void", sizeof("void") - 1); EMPTY_SWITCH_DEFAULT_CASE() } } diff --git a/ext/reflection/tests/ReflectionType_possible_types.phpt b/ext/reflection/tests/ReflectionType_possible_types.phpt new file mode 100644 index 0000000000..9f876cb6f5 --- /dev/null +++ b/ext/reflection/tests/ReflectionType_possible_types.phpt @@ -0,0 +1,29 @@ +--TEST-- +ReflectionType possible types +--FILE-- +getReturnType(); + var_dump($returnType->__toString()); +} +?> +--EXPECTF-- +string(3) "int" +string(5) "float" +string(6) "string" +string(4) "bool" +string(5) "array" +string(8) "callable" +string(8) "StdClass" -- 2.50.1