Skip to content

Commit 1b66ba1

Browse files
committed
Remove unnecessary explicit argc check
Instead specify a default value for the argument, which is more idiomatic.
1 parent 76f1d98 commit 1b66ba1

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

ext/reflection/php_reflection.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4185,16 +4185,10 @@ ZEND_METHOD(reflection_class, getMethods)
41854185
{
41864186
reflection_object *intern;
41874187
zend_class_entry *ce;
4188-
zend_long filter = 0;
4189-
int argc = ZEND_NUM_ARGS();
4188+
zend_long filter = ZEND_ACC_PPP_MASK | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL | ZEND_ACC_STATIC;
41904189

4191-
if (argc) {
4192-
if (zend_parse_parameters(argc, "|l", &filter) == FAILURE) {
4193-
return;
4194-
}
4195-
} else {
4196-
/* No parameters given, default to "return all" */
4197-
filter = ZEND_ACC_PPP_MASK | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL | ZEND_ACC_STATIC;
4190+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &filter) == FAILURE) {
4191+
return;
41984192
}
41994193

42004194
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4377,16 +4371,10 @@ ZEND_METHOD(reflection_class, getProperties)
43774371
{
43784372
reflection_object *intern;
43794373
zend_class_entry *ce;
4380-
zend_long filter = 0;
4381-
int argc = ZEND_NUM_ARGS();
4374+
zend_long filter = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC;
43824375

4383-
if (argc) {
4384-
if (zend_parse_parameters(argc, "|l", &filter) == FAILURE) {
4385-
return;
4386-
}
4387-
} else {
4388-
/* No parameters given, default to "return all" */
4389-
filter = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC;
4376+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &filter) == FAILURE) {
4377+
return;
43904378
}
43914379

43924380
GET_REFLECTION_OBJECT_PTR(ce);

0 commit comments

Comments
 (0)