Skip to content

Commit 012ec21

Browse files
committed
Remove unused parameter from zend_compile_typename()
The force_allow_null parameter is always false, therefore it is not needed. This simplification paves the road for deprecating implicitly nullable parameter types.
1 parent f1f33ee commit 012ec21

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

Zend/zend_compile.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6560,7 +6560,7 @@ static void zend_is_type_list_redundant_by_single_type(zend_type_list *type_list
65606560
}
65616561
}
65626562

6563-
static zend_type zend_compile_typename(zend_ast *ast, bool force_allow_null);
6563+
static zend_type zend_compile_typename(zend_ast *ast);
65646564

65656565
static zend_type zend_compile_typename_ex(
65666566
zend_ast *ast, bool force_allow_null, bool *forced_allow_null) /* {{{ */
@@ -6601,7 +6601,7 @@ static zend_type zend_compile_typename_ex(
66016601
/* Mark type as list type */
66026602
ZEND_TYPE_SET_LIST(type, type_list);
66036603

6604-
single_type = zend_compile_typename(type_ast, false);
6604+
single_type = zend_compile_typename(type_ast);
66056605
ZEND_ASSERT(ZEND_TYPE_IS_INTERSECTION(single_type));
66066606

66076607
type_list->types[type_list->num_types++] = single_type;
@@ -6788,10 +6788,10 @@ static zend_type zend_compile_typename_ex(
67886788
}
67896789
/* }}} */
67906790

6791-
static zend_type zend_compile_typename(zend_ast *ast, bool force_allow_null)
6791+
static zend_type zend_compile_typename(zend_ast *ast)
67926792
{
67936793
bool forced_allow_null;
6794-
return zend_compile_typename_ex(ast, force_allow_null, &forced_allow_null);
6794+
return zend_compile_typename_ex(ast, false, &forced_allow_null);
67956795
}
67966796

67976797
/* May convert value from int to float. */
@@ -6937,8 +6937,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
69376937
arg_infos = safe_emalloc(sizeof(zend_arg_info), list->children + 1, 0);
69386938
arg_infos->name = NULL;
69396939
if (return_type_ast) {
6940-
arg_infos->type = zend_compile_typename(
6941-
return_type_ast, /* force_allow_null */ 0);
6940+
arg_infos->type = zend_compile_typename(return_type_ast);
69426941
ZEND_TYPE_FULL_MASK(arg_infos->type) |= _ZEND_ARG_INFO_FLAGS(
69436942
(op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0, /* is_variadic */ 0, /* is_tentative */ 0);
69446943
} else {
@@ -7141,7 +7140,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
71417140
/* Recompile the type, as it has different memory management requirements. */
71427141
zend_type type = ZEND_TYPE_INIT_NONE(0);
71437142
if (type_ast) {
7144-
type = zend_compile_typename(type_ast, /* force_allow_null */ 0);
7143+
type = zend_compile_typename(type_ast);
71457144
}
71467145

71477146
/* Don't give the property an explicit default value. For typed properties this means
@@ -7715,7 +7714,7 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f
77157714
zend_type type = ZEND_TYPE_INIT_NONE(0);
77167715

77177716
if (type_ast) {
7718-
type = zend_compile_typename(type_ast, /* force_allow_null */ 0);
7717+
type = zend_compile_typename(type_ast);
77197718

77207719
if (ZEND_TYPE_FULL_MASK(type) & (MAY_BE_VOID|MAY_BE_NEVER|MAY_BE_CALLABLE)) {
77217720
zend_string *str = zend_type_to_string(type);
@@ -7830,7 +7829,7 @@ static void zend_compile_class_const_decl(zend_ast *ast, uint32_t flags, zend_as
78307829
zend_type type = ZEND_TYPE_INIT_NONE(0);
78317830

78327831
if (type_ast) {
7833-
type = zend_compile_typename(type_ast, /* force_allow_null */ 0);
7832+
type = zend_compile_typename(type_ast);
78347833

78357834
uint32_t type_mask = ZEND_TYPE_PURE_MASK(type);
78367835

@@ -8023,7 +8022,7 @@ static zend_string *zend_generate_anon_class_name(zend_ast_decl *decl)
80238022
static void zend_compile_enum_backing_type(zend_class_entry *ce, zend_ast *enum_backing_type_ast)
80248023
{
80258024
ZEND_ASSERT(ce->ce_flags & ZEND_ACC_ENUM);
8026-
zend_type type = zend_compile_typename(enum_backing_type_ast, 0);
8025+
zend_type type = zend_compile_typename(enum_backing_type_ast);
80278026
uint32_t type_mask = ZEND_TYPE_PURE_MASK(type);
80288027
if (ZEND_TYPE_IS_COMPLEX(type) || (type_mask != MAY_BE_LONG && type_mask != MAY_BE_STRING)) {
80298028
zend_string *type_string = zend_type_to_string(type);

0 commit comments

Comments
 (0)