Skip to content

Commit

Permalink
Improve static inference in final class (php#13298)
Browse files Browse the repository at this point in the history
static may be treated like self if the class is final.
  • Loading branch information
iluuu1994 authored Feb 1, 2024
1 parent 2bf9f7e commit 95f7335
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Zend/Optimizer/zend_optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,9 @@ zend_class_entry *zend_optimizer_get_class_entry_from_op1(
}
} else if (opline->op1_type == IS_UNUSED && op_array->scope
&& !(op_array->scope->ce_flags & ZEND_ACC_TRAIT)
&& (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) {
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF
|| ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_STATIC
&& (op_array->scope->ce_flags & ZEND_ACC_FINAL)))) {
return op_array->scope;
}
return NULL;
Expand Down

0 comments on commit 95f7335

Please sign in to comment.