mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
Fix some remaining class declaration issues
This commit is contained in:
parent
df970e9fc2
commit
61a6083e99
@ -12,4 +12,4 @@ class C extends A implements B {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class C contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (A::foo, B::bar) in %sbug44414.php on line 9
|
||||
Fatal error: Class C contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (A::foo, B::bar) in %sbug44414.php on line 8
|
||||
|
@ -6673,8 +6673,9 @@ void zend_compile_class_decl(zend_ast *ast TSRMLS_DC) {
|
||||
}
|
||||
|
||||
if (!zend_is_const_default_class_ref(extends_ast)) {
|
||||
zend_string *extends_name = Z_STR_P(zend_ast_get_zval(extends_ast));
|
||||
zend_error_noreturn(E_COMPILE_ERROR,
|
||||
"Cannot use '%s' as class name as it is reserved", name->val);
|
||||
"Cannot use '%s' as class name as it is reserved", extends_name->val);
|
||||
}
|
||||
|
||||
zend_compile_class_ref(&extends_node, extends_ast TSRMLS_CC);
|
||||
@ -6715,7 +6716,27 @@ void zend_compile_class_decl(zend_ast *ast TSRMLS_DC) {
|
||||
|
||||
zend_compile_stmt(stmt_ast TSRMLS_CC);
|
||||
|
||||
// TODO.AST validity checks
|
||||
if (ce->constructor) {
|
||||
ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
|
||||
if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static",
|
||||
ce->name->val, ce->constructor->common.function_name->val);
|
||||
}
|
||||
}
|
||||
if (ce->destructor) {
|
||||
ce->destructor->common.fn_flags |= ZEND_ACC_DTOR;
|
||||
if (ce->destructor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Destructor %s::%s() cannot be static",
|
||||
ce->name->val, ce->destructor->common.function_name->val);
|
||||
}
|
||||
}
|
||||
if (ce->clone) {
|
||||
ce->clone->common.fn_flags |= ZEND_ACC_CLONE;
|
||||
if (ce->clone->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Clone method %s::%s() cannot be static",
|
||||
ce->name->val, ce->clone->common.function_name->val);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for traits and proceed like with interfaces.
|
||||
* The only difference will be a combined handling of them in the end.
|
||||
|
Loading…
Reference in New Issue
Block a user