Skip to content

Commit 9d37a57

Browse files
committed
Remove bool return type from assert_options
Not seeing any way this function can return bool.
1 parent fda78e5 commit 9d37a57

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static const func_info_t func_infos[] = {
412412
F1("array_chunk", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
413413
F1("array_combine", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
414414
F1("pos", UNKNOWN_INFO),
415-
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),
415+
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),
416416
F1("str_rot13", MAY_BE_STRING),
417417
F1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
418418
F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_OBJECT),

ext/standard/assert.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ PHP_FUNCTION(assert_options)
238238
if (ac == 2) {
239239
zend_string *value_str = zval_try_get_string(value);
240240
if (UNEXPECTED(!value_str)) {
241-
return;
241+
RETURN_THROWS();
242242
}
243243

244244
key = zend_string_init("assert.active", sizeof("assert.active")-1, 0);
@@ -254,7 +254,7 @@ PHP_FUNCTION(assert_options)
254254
if (ac == 2) {
255255
zend_string *value_str = zval_try_get_string(value);
256256
if (UNEXPECTED(!value_str)) {
257-
return;
257+
RETURN_THROWS();
258258
}
259259

260260
key = zend_string_init("assert.bail", sizeof("assert.bail")-1, 0);
@@ -270,7 +270,7 @@ PHP_FUNCTION(assert_options)
270270
if (ac == 2) {
271271
zend_string *value_str = zval_try_get_string(value);
272272
if (UNEXPECTED(!value_str)) {
273-
return;
273+
RETURN_THROWS();
274274
}
275275

276276
key = zend_string_init("assert.warning", sizeof("assert.warning")-1, 0);
@@ -300,7 +300,7 @@ PHP_FUNCTION(assert_options)
300300
if (ac == 2) {
301301
zend_string *val = zval_try_get_string(value);
302302
if (UNEXPECTED(!val)) {
303-
return;
303+
RETURN_THROWS();
304304
}
305305

306306
key = zend_string_init("assert.exception", sizeof("assert.exception")-1, 0);
@@ -313,9 +313,7 @@ PHP_FUNCTION(assert_options)
313313

314314
default:
315315
zend_argument_value_error(1, "must have a valid value");
316-
break;
316+
RETURN_THROWS();
317317
}
318-
319-
return;
320318
}
321319
/* }}} */

ext/standard/basic_functions.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ function get_html_translation_table(int $table = HTML_SPECIALCHARS, int $quote_s
508508
/** @param mixed $assertion */
509509
function assert($assertion, $description = null): bool {}
510510

511-
function assert_options(int $what, $value = UNKNOWN): array|object|int|string|bool|null {}
511+
function assert_options(int $what, $value = UNKNOWN): array|object|int|string|null {}
512512

513513
/* string.c */
514514

ext/standard/basic_functions_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 0a66e5b2c71762a74b9ff9ad11f80d265ef806e3 */
2+
* Stub hash: 3f739b2ab0c9317b5e52779e16f4bf56bd19d86e */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
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)
801801
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, description, "null")
802802
ZEND_END_ARG_INFO()
803803

804-
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)
804+
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)
805805
ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
806806
ZEND_ARG_INFO(0, value)
807807
ZEND_END_ARG_INFO()

0 commit comments

Comments
 (0)