Skip to content

Commit 4451788

Browse files
committed
Differentiate inferred and explicit staticness in reflection function dump
1 parent 0280d34 commit 4451788

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

ext/reflection/php_reflection.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,9 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent
904904
if (fptr->common.fn_flags & ZEND_ACC_CTOR) {
905905
smart_str_appends(str, ", ctor");
906906
}
907+
if ((fptr->common.fn_flags & ZEND_ACC_STATIC) && (fptr->common.fn_flags2 & ZEND_ACC2_INFERRED_STATIC)) {
908+
smart_str_appends(str, ", inferred static");
909+
}
907910
smart_str_appends(str, "> ");
908911

909912
if (fptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
@@ -912,7 +915,9 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent
912915
if (fptr->common.fn_flags & ZEND_ACC_FINAL) {
913916
smart_str_appends(str, "final ");
914917
}
915-
if (fptr->common.fn_flags & ZEND_ACC_STATIC) {
918+
if ((fptr->common.fn_flags & ZEND_ACC_STATIC)
919+
/* Don't show static twice for static-inferred functions. */
920+
&& !(fptr->common.fn_flags2 & ZEND_ACC2_INFERRED_STATIC)) {
916921
smart_str_appends(str, "static ");
917922
}
918923

ext/reflection/tests/ReflectionFunction__toString_bound_variables.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ echo (string) $rf;
1919

2020
?>
2121
--EXPECTF--
22-
Closure [ <user> static function {closure:%s:%d} ] {
22+
Closure [ <user, inferred static> function {closure:%s:%d} ] {
2323
@@ %sReflectionFunction__toString_bound_variables.php 3 - 3
2424
}
25-
Closure [ <user> static function {closure:%s:%d} ] {
25+
Closure [ <user, inferred static> function {closure:%s:%d} ] {
2626
@@ %sReflectionFunction__toString_bound_variables.php 9 - 12
2727

2828
- Bound Variables [2] {

0 commit comments

Comments
 (0)