Skip to content

Commit 0caae35

Browse files
committed
Treat "static" as class type in reflection
1 parent d44645d commit 0caae35

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ext/reflection/php_reflection.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2909,7 +2909,9 @@ ZEND_METHOD(reflection_named_type, isBuiltin)
29092909
}
29102910
GET_REFLECTION_OBJECT_PTR(param);
29112911

2912-
RETVAL_BOOL(ZEND_TYPE_IS_ONLY_MASK(param->type));
2912+
/* Treat "static" as a class type for the purposes of reflection. */
2913+
RETVAL_BOOL(ZEND_TYPE_IS_ONLY_MASK(param->type)
2914+
&& !(ZEND_TYPE_FULL_MASK(param->type) & MAY_BE_STATIC));
29132915
}
29142916
/* }}} */
29152917

ext/reflection/tests/static_type.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ class A {
1111

1212
$rm = new ReflectionMethod(A::class, 'test');
1313
$rt = $rm->getReturnType();
14-
// TODO: Should it be considered a builtin or not?
1514
var_dump($rt->isBuiltin());
1615
var_dump($rt->getName());
1716
var_dump((string) $rt);
1817

1918
?>
2019
--EXPECT--
21-
bool(true)
20+
bool(false)
2221
string(6) "static"
2322
string(6) "static"

0 commit comments

Comments
 (0)