Skip to content

Commit 95f7335

Browse files
authored
Improve static inference in final class (#13298)
static may be treated like self if the class is final.
1 parent 2bf9f7e commit 95f7335

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Zend/Optimizer/zend_optimizer.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,9 @@ zend_class_entry *zend_optimizer_get_class_entry_from_op1(
821821
}
822822
} else if (opline->op1_type == IS_UNUSED && op_array->scope
823823
&& !(op_array->scope->ce_flags & ZEND_ACC_TRAIT)
824-
&& (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) {
824+
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF
825+
|| ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_STATIC
826+
&& (op_array->scope->ce_flags & ZEND_ACC_FINAL)))) {
825827
return op_array->scope;
826828
}
827829
return NULL;

0 commit comments

Comments
 (0)