mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.4'
* PHP-8.4: Disallow asymmetric visibility on static properties
This commit is contained in:
commit
ec152105f2
2 changed files with 16 additions and 0 deletions
12
Zend/tests/asymmetric_visibility/static_props.phpt
Normal file
12
Zend/tests/asymmetric_visibility/static_props.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
Asymmetric visibility on static props
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public private(set) static int $prop;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Static property may not have asymmetric visibility in %s on line %d
|
|
@ -8598,6 +8598,10 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f
|
|||
zend_error_noreturn(E_COMPILE_ERROR, "Property cannot be both final and private");
|
||||
}
|
||||
|
||||
if ((flags & ZEND_ACC_STATIC) && (flags & ZEND_ACC_PPP_SET_MASK)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Static property may not have asymmetric visibility");
|
||||
}
|
||||
|
||||
if (ce->ce_flags & ZEND_ACC_INTERFACE) {
|
||||
if (flags & ZEND_ACC_FINAL) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Property in interface cannot be final");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue