Skip to content

Commit 8e66b4e

Browse files
committed
reflection: Use true / false instead of 1 / 0 for bool parameters
Changes done with Coccinelle: @r1@ identifier F; identifier p; typedef bool; parameter list [n1] PL1; parameter list [n2] PL2; @@ F(PL1, bool p, PL2) { ... } @r2@ identifier r1.F; expression list [r1.n1] EL1; expression list [r1.n2] EL2; @@ F(EL1, ( - 1 + true | - 0 + false ) , EL2)
1 parent 26f88c6 commit 8e66b4e

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

ext/reflection/php_reflection.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2832,7 +2832,7 @@ ZEND_METHOD(ReflectionParameter, getType)
28322832
if (!ZEND_TYPE_IS_SET(param->arg_info->type)) {
28332833
RETURN_NULL();
28342834
}
2835-
reflection_type_factory(param->arg_info->type, return_value, 1);
2835+
reflection_type_factory(param->arg_info->type, return_value, true);
28362836
}
28372837
/* }}} */
28382838

@@ -3177,7 +3177,7 @@ static void append_type(zval *return_value, zend_type type) {
31773177
ZEND_TYPE_FULL_MASK(type) &= ~_ZEND_TYPE_ITERABLE_BIT;
31783178
}
31793179

3180-
reflection_type_factory(type, &reflection_type, 0);
3180+
reflection_type_factory(type, &reflection_type, false);
31813181
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &reflection_type);
31823182
}
31833183

@@ -3679,7 +3679,7 @@ ZEND_METHOD(ReflectionFunctionAbstract, getReturnType)
36793679
RETURN_NULL();
36803680
}
36813681

3682-
reflection_type_factory(fptr->common.arg_info[-1].type, return_value, 1);
3682+
reflection_type_factory(fptr->common.arg_info[-1].type, return_value, true);
36833683
}
36843684
/* }}} */
36853685

@@ -3711,7 +3711,7 @@ ZEND_METHOD(ReflectionFunctionAbstract, getTentativeReturnType)
37113711
RETURN_NULL();
37123712
}
37133713

3714-
reflection_type_factory(fptr->common.arg_info[-1].type, return_value, 1);
3714+
reflection_type_factory(fptr->common.arg_info[-1].type, return_value, true);
37153715
}
37163716
/* }}} */
37173717

@@ -3914,7 +3914,7 @@ ZEND_METHOD(ReflectionClassConstant, getType)
39143914
RETURN_NULL();
39153915
}
39163916

3917-
reflection_type_factory(ref->type, return_value, 1);
3917+
reflection_type_factory(ref->type, return_value, true);
39183918
}
39193919

39203920
/* Returns whether class constant has a type */
@@ -4314,8 +4314,8 @@ ZEND_METHOD(ReflectionClass, getDefaultProperties)
43144314
if (UNEXPECTED(zend_update_class_constants(ce) != SUCCESS)) {
43154315
RETURN_THROWS();
43164316
}
4317-
add_class_vars(ce, 1, return_value);
4318-
add_class_vars(ce, 0, return_value);
4317+
add_class_vars(ce, true, return_value);
4318+
add_class_vars(ce, false, return_value);
43194319
}
43204320
/* }}} */
43214321

@@ -6428,7 +6428,7 @@ ZEND_METHOD(ReflectionProperty, getType)
64286428
RETURN_NULL();
64296429
}
64306430

6431-
reflection_type_factory(ref->prop->type, return_value, 1);
6431+
reflection_type_factory(ref->prop->type, return_value, true);
64326432
}
64336433
/* }}} */
64346434

@@ -6450,7 +6450,7 @@ ZEND_METHOD(ReflectionProperty, getSettableType)
64506450
/* Get-only virtual property can never be written to. */
64516451
if (prop->hooks && (prop->flags & ZEND_ACC_VIRTUAL) && !prop->hooks[ZEND_PROPERTY_HOOK_SET]) {
64526452
zend_type never_type = ZEND_TYPE_INIT_CODE(IS_NEVER, 0, 0);
6453-
reflection_type_factory(never_type, return_value, 1);
6453+
reflection_type_factory(never_type, return_value, true);
64546454
return;
64556455
}
64566456

@@ -6460,15 +6460,15 @@ ZEND_METHOD(ReflectionProperty, getSettableType)
64606460
if (!ZEND_TYPE_IS_SET(arg_info->type)) {
64616461
RETURN_NULL();
64626462
}
6463-
reflection_type_factory(arg_info->type, return_value, 1);
6463+
reflection_type_factory(arg_info->type, return_value, true);
64646464
return;
64656465
}
64666466

64676467
/* Fall back to property type */
64686468
if (!ZEND_TYPE_IS_SET(ref->prop->type)) {
64696469
RETURN_NULL();
64706470
}
6471-
reflection_type_factory(ref->prop->type, return_value, 1);
6471+
reflection_type_factory(ref->prop->type, return_value, true);
64726472
}
64736473

64746474
/* {{{ Returns whether property has a type */
@@ -6848,7 +6848,7 @@ ZEND_METHOD(ReflectionExtension, getClasses)
68486848

68496849
array_init(return_value);
68506850
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(EG(class_table), key, ce) {
6851-
add_extension_class(ce, key, return_value, module, 1);
6851+
add_extension_class(ce, key, return_value, module, true);
68526852
} ZEND_HASH_FOREACH_END();
68536853
}
68546854
/* }}} */
@@ -6866,7 +6866,7 @@ ZEND_METHOD(ReflectionExtension, getClassNames)
68666866

68676867
array_init(return_value);
68686868
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(EG(class_table), key, ce) {
6869-
add_extension_class(ce, key, return_value, module, 0);
6869+
add_extension_class(ce, key, return_value, module, false);
68706870
} ZEND_HASH_FOREACH_END();
68716871
}
68726872
/* }}} */
@@ -7509,7 +7509,7 @@ ZEND_METHOD(ReflectionEnum, getBackingType)
75097509
RETURN_NULL();
75107510
} else {
75117511
zend_type type = ZEND_TYPE_INIT_CODE(ce->enum_backing_type, 0, 0);
7512-
reflection_type_factory(type, return_value, 0);
7512+
reflection_type_factory(type, return_value, false);
75137513
}
75147514
}
75157515

0 commit comments

Comments
 (0)