@@ -1407,10 +1407,10 @@ static zend_string *resolve_class_name(zend_string *name, zend_class_entry *scop
1407
1407
}
1408
1408
1409
1409
static zend_string * add_intersection_type (zend_string * str ,
1410
- zend_type_list * intersection_type_list , zend_class_entry * scope ,
1410
+ const zend_type_list * intersection_type_list , zend_class_entry * scope ,
1411
1411
bool is_bracketed )
1412
1412
{
1413
- zend_type * single_type ;
1413
+ const zend_type * single_type ;
1414
1414
zend_string * intersection_str = NULL ;
1415
1415
1416
1416
ZEND_TYPE_LIST_FOREACH (intersection_type_list , single_type ) {
@@ -1432,7 +1432,7 @@ static zend_string *add_intersection_type(zend_string *str,
1432
1432
return str ;
1433
1433
}
1434
1434
1435
- zend_string * zend_type_to_string_resolved (zend_type type , zend_class_entry * scope ) {
1435
+ zend_string * zend_type_to_string_resolved (const zend_type type , zend_class_entry * scope ) {
1436
1436
zend_string * str = NULL ;
1437
1437
1438
1438
/* Pure intersection type */
@@ -1441,7 +1441,7 @@ zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scop
1441
1441
str = add_intersection_type (str , ZEND_TYPE_LIST (type ), scope , /* is_bracketed */ false);
1442
1442
} else if (ZEND_TYPE_HAS_LIST (type )) {
1443
1443
/* A union type might not be a list */
1444
- zend_type * list_type ;
1444
+ const zend_type * list_type ;
1445
1445
ZEND_TYPE_LIST_FOREACH (ZEND_TYPE_LIST (type ), list_type ) {
1446
1446
if (ZEND_TYPE_IS_INTERSECTION (* list_type )) {
1447
1447
str = add_intersection_type (str , ZEND_TYPE_LIST (* list_type ), scope , /* is_bracketed */ true);
@@ -1527,7 +1527,7 @@ ZEND_API zend_string *zend_type_to_string(zend_type type) {
1527
1527
return zend_type_to_string_resolved (type , NULL );
1528
1528
}
1529
1529
1530
- static bool is_generator_compatible_class_type (zend_string * name ) {
1530
+ static bool is_generator_compatible_class_type (const zend_string * name ) {
1531
1531
return zend_string_equals_ci (name , ZSTR_KNOWN (ZEND_STR_TRAVERSABLE ))
1532
1532
|| zend_string_equals_literal_ci (name , "Iterator" )
1533
1533
|| zend_string_equals_literal_ci (name , "Generator" );
@@ -1541,10 +1541,10 @@ static void zend_mark_function_as_generator(void) /* {{{ */
1541
1541
}
1542
1542
1543
1543
if (CG (active_op_array )-> fn_flags & ZEND_ACC_HAS_RETURN_TYPE ) {
1544
- zend_type return_type = CG (active_op_array )-> arg_info [-1 ].type ;
1544
+ const zend_type return_type = CG (active_op_array )-> arg_info [-1 ].type ;
1545
1545
bool valid_type = (ZEND_TYPE_FULL_MASK (return_type ) & MAY_BE_OBJECT ) != 0 ;
1546
1546
if (!valid_type ) {
1547
- zend_type * single_type ;
1547
+ const zend_type * single_type ;
1548
1548
ZEND_TYPE_FOREACH (return_type , single_type ) {
1549
1549
if (ZEND_TYPE_HAS_NAME (* single_type )
1550
1550
&& is_generator_compatible_class_type (ZEND_TYPE_NAME (* single_type ))) {
@@ -2621,7 +2621,7 @@ static void zend_compile_memoized_expr(znode *result, zend_ast *expr) /* {{{ */
2621
2621
/* }}} */
2622
2622
2623
2623
/* Remember to update type_num_classes() in compact_literals.c when changing this function */
2624
- static size_t zend_type_get_num_classes (zend_type type ) {
2624
+ static size_t zend_type_get_num_classes (const zend_type type ) {
2625
2625
if (!ZEND_TYPE_IS_COMPLEX (type )) {
2626
2626
return 0 ;
2627
2627
}
@@ -2632,7 +2632,7 @@ static size_t zend_type_get_num_classes(zend_type type) {
2632
2632
}
2633
2633
ZEND_ASSERT (ZEND_TYPE_IS_UNION (type ));
2634
2634
size_t count = 0 ;
2635
- zend_type * list_type ;
2635
+ const zend_type * list_type ;
2636
2636
2637
2637
ZEND_TYPE_LIST_FOREACH (ZEND_TYPE_LIST (type ), list_type ) {
2638
2638
if (ZEND_TYPE_IS_INTERSECTION (* list_type )) {
@@ -7048,7 +7048,7 @@ static zend_type zend_compile_single_typename(zend_ast *ast)
7048
7048
}
7049
7049
}
7050
7050
7051
- static void zend_are_intersection_types_redundant (zend_type left_type , zend_type right_type )
7051
+ static void zend_are_intersection_types_redundant (const zend_type left_type , const zend_type right_type )
7052
7052
{
7053
7053
ZEND_ASSERT (ZEND_TYPE_IS_INTERSECTION (left_type ));
7054
7054
ZEND_ASSERT (ZEND_TYPE_IS_INTERSECTION (right_type ));
@@ -7067,9 +7067,9 @@ static void zend_are_intersection_types_redundant(zend_type left_type, zend_type
7067
7067
}
7068
7068
7069
7069
unsigned int sum = 0 ;
7070
- zend_type * outer_type ;
7070
+ const zend_type * outer_type ;
7071
7071
ZEND_TYPE_LIST_FOREACH (smaller_type_list , outer_type )
7072
- zend_type * inner_type ;
7072
+ const zend_type * inner_type ;
7073
7073
ZEND_TYPE_LIST_FOREACH (larger_type_list , inner_type )
7074
7074
if (zend_string_equals_ci (ZEND_TYPE_NAME (* inner_type ), ZEND_TYPE_NAME (* outer_type ))) {
7075
7075
sum ++ ;
@@ -7098,12 +7098,12 @@ static void zend_are_intersection_types_redundant(zend_type left_type, zend_type
7098
7098
}
7099
7099
}
7100
7100
7101
- static void zend_is_intersection_type_redundant_by_single_type (zend_type intersection_type , zend_type single_type )
7101
+ static void zend_is_intersection_type_redundant_by_single_type (const zend_type intersection_type , const zend_type single_type )
7102
7102
{
7103
7103
ZEND_ASSERT (ZEND_TYPE_IS_INTERSECTION (intersection_type ));
7104
7104
ZEND_ASSERT (!ZEND_TYPE_IS_INTERSECTION (single_type ));
7105
7105
7106
- zend_type * single_intersection_type = NULL ;
7106
+ const zend_type * single_intersection_type = NULL ;
7107
7107
ZEND_TYPE_FOREACH (intersection_type , single_intersection_type )
7108
7108
if (zend_string_equals_ci (ZEND_TYPE_NAME (* single_intersection_type ), ZEND_TYPE_NAME (single_type ))) {
7109
7109
zend_string * single_type_str = zend_type_to_string (single_type );
@@ -7115,7 +7115,7 @@ static void zend_is_intersection_type_redundant_by_single_type(zend_type interse
7115
7115
}
7116
7116
7117
7117
/* Used by both intersection and union types prior to transforming the type list to a full zend_type */
7118
- static void zend_is_type_list_redundant_by_single_type (zend_type_list * type_list , zend_type type )
7118
+ static void zend_is_type_list_redundant_by_single_type (const zend_type_list * type_list , const zend_type type )
7119
7119
{
7120
7120
ZEND_ASSERT (!ZEND_TYPE_IS_INTERSECTION (type ));
7121
7121
for (size_t i = 0 ; i < type_list -> num_types - 1 ; i ++ ) {
0 commit comments