mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Simplify ReflectionProperty::getDeclaringClass()
This commit is contained in:
parent
13178087c7
commit
1f1a7ecaf2
1 changed files with 2 additions and 16 deletions
|
@ -5601,28 +5601,14 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
|
|||
{
|
||||
reflection_object *intern;
|
||||
property_reference *ref;
|
||||
zend_class_entry *tmp_ce, *ce;
|
||||
zend_property_info *tmp_info;
|
||||
zend_class_entry *ce;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
|
||||
ce = tmp_ce = intern->ce;
|
||||
while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, ref->unmangled_name)) != NULL) {
|
||||
if (tmp_info->flags & ZEND_ACC_PRIVATE) {
|
||||
/* it's a private property, so it can't be inherited */
|
||||
break;
|
||||
}
|
||||
ce = tmp_ce;
|
||||
if (tmp_ce == tmp_info->ce) {
|
||||
/* declared in this class, done */
|
||||
break;
|
||||
}
|
||||
tmp_ce = tmp_ce->parent;
|
||||
}
|
||||
|
||||
ce = ref->prop ? ref->prop->ce : intern->ce;
|
||||
zend_reflection_class_factory(ce, return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue