]> granicus.if.org Git - php/commitdiff
Remove bool return type from assert_options
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 21 Jul 2020 08:17:21 +0000 (10:17 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 21 Jul 2020 08:18:33 +0000 (10:18 +0200)
Not seeing any way this function can return bool.

ext/opcache/Optimizer/zend_func_info.c
ext/standard/assert.c
ext/standard/basic_functions.stub.php
ext/standard/basic_functions_arginfo.h

index c99537dec82d5877aab7f3ebe2de9650a9b3b45c..4daf43b27ab2a1560e1df2c7608ac4936bf068cc 100644 (file)
@@ -412,7 +412,7 @@ static const func_info_t func_infos[] = {
        F1("array_chunk",                  MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
        F1("array_combine",                MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
        F1("pos",                          UNKNOWN_INFO),
-       F1("assert_options",               MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
+       F1("assert_options",               MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
        F1("str_rot13",                    MAY_BE_STRING),
        F1("stream_get_filters",           MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
        F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_OBJECT),
index 3aac8d6e482cd3ba45dcf1e5979a28d6d55e0333..45648fbc494724522cf6ada588079d94a6715a9d 100644 (file)
@@ -238,7 +238,7 @@ PHP_FUNCTION(assert_options)
                if (ac == 2) {
                        zend_string *value_str = zval_try_get_string(value);
                        if (UNEXPECTED(!value_str)) {
-                               return;
+                               RETURN_THROWS();
                        }
 
                        key = zend_string_init("assert.active", sizeof("assert.active")-1, 0);
@@ -254,7 +254,7 @@ PHP_FUNCTION(assert_options)
                if (ac == 2) {
                        zend_string *value_str = zval_try_get_string(value);
                        if (UNEXPECTED(!value_str)) {
-                               return;
+                               RETURN_THROWS();
                        }
 
                        key = zend_string_init("assert.bail", sizeof("assert.bail")-1, 0);
@@ -270,7 +270,7 @@ PHP_FUNCTION(assert_options)
                if (ac == 2) {
                        zend_string *value_str = zval_try_get_string(value);
                        if (UNEXPECTED(!value_str)) {
-                               return;
+                               RETURN_THROWS();
                        }
 
                        key = zend_string_init("assert.warning", sizeof("assert.warning")-1, 0);
@@ -300,7 +300,7 @@ PHP_FUNCTION(assert_options)
                if (ac == 2) {
                        zend_string *val = zval_try_get_string(value);
                        if (UNEXPECTED(!val)) {
-                               return;
+                               RETURN_THROWS();
                        }
 
                        key = zend_string_init("assert.exception", sizeof("assert.exception")-1, 0);
@@ -313,9 +313,7 @@ PHP_FUNCTION(assert_options)
 
        default:
                zend_argument_value_error(1, "must have a valid value");
-               break;
+               RETURN_THROWS();
        }
-
-       return;
 }
 /* }}} */
index 9a27ae551284f810740023b27a74a1b9da58307d..d60dc6157742ee1af4d2e9fbeb01d2cc94f01ca1 100755 (executable)
@@ -508,7 +508,7 @@ function get_html_translation_table(int $table = HTML_SPECIALCHARS, int $quote_s
 /** @param mixed $assertion */
 function assert($assertion, $description = null): bool {}
 
-function assert_options(int $what, $value = UNKNOWN): array|object|int|string|bool|null {}
+function assert_options(int $what, $value = UNKNOWN): array|object|int|string|null {}
 
 /* string.c */
 
index 46d323081bed9bcdc03f99be5a2bb514e26507e3..c2060d7890d66e882d72b720f38cad31eebeade1 100755 (executable)
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 0a66e5b2c71762a74b9ff9ad11f80d265ef806e3 */
+ * Stub hash: 3f739b2ab0c9317b5e52779e16f4bf56bd19d86e */
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
        ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
@@ -801,7 +801,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_assert, 0, 1, _IS_BOOL, 0)
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, description, "null")
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_assert_options, 0, 1, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_LONG|MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_assert_options, 0, 1, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_LONG|MAY_BE_STRING|MAY_BE_NULL)
        ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
        ZEND_ARG_INFO(0, value)
 ZEND_END_ARG_INFO()