Skip to content

Commit 1f1a7ec

Browse files
committed
Simplify ReflectionProperty::getDeclaringClass()
1 parent 1317808 commit 1f1a7ec

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

ext/reflection/php_reflection.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5601,28 +5601,14 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
56015601
{
56025602
reflection_object *intern;
56035603
property_reference *ref;
5604-
zend_class_entry *tmp_ce, *ce;
5605-
zend_property_info *tmp_info;
5604+
zend_class_entry *ce;
56065605

56075606
if (zend_parse_parameters_none() == FAILURE) {
56085607
RETURN_THROWS();
56095608
}
56105609
GET_REFLECTION_OBJECT_PTR(ref);
56115610

5612-
ce = tmp_ce = intern->ce;
5613-
while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, ref->unmangled_name)) != NULL) {
5614-
if (tmp_info->flags & ZEND_ACC_PRIVATE) {
5615-
/* it's a private property, so it can't be inherited */
5616-
break;
5617-
}
5618-
ce = tmp_ce;
5619-
if (tmp_ce == tmp_info->ce) {
5620-
/* declared in this class, done */
5621-
break;
5622-
}
5623-
tmp_ce = tmp_ce->parent;
5624-
}
5625-
5611+
ce = ref->prop ? ref->prop->ce : intern->ce;
56265612
zend_reflection_class_factory(ce, return_value);
56275613
}
56285614
/* }}} */

0 commit comments

Comments
 (0)