1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 2.00 of the Zend license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.zend.com/license/2_00.txt. |
11 | If you did not receive a copy of the Zend license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@zend.com so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Andi Gutmans <andi@php.net> |
16 | Zeev Suraski <zeev@php.net> |
17 +----------------------------------------------------------------------+
18 */
19
20 #ifndef ZEND_INHERITANCE_H
21 #define ZEND_INHERITANCE_H
22
23 #include "zend.h"
24 #include "zend_compile.h"
25
26 BEGIN_EXTERN_C()
27
28 ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface);
29 ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *parent_ce, bool checked);
30
zend_do_inheritance(zend_class_entry * ce,zend_class_entry * parent_ce)31 static zend_always_inline void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce) {
32 zend_do_inheritance_ex(ce, parent_ce, 0);
33 }
34
35 ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name, zend_string *key);
36
37 void zend_verify_abstract_class(zend_class_entry *ce);
38 void zend_build_properties_info_table(zend_class_entry *ce);
39 ZEND_API zend_class_entry *zend_try_early_bind(zend_class_entry *ce, zend_class_entry *parent_ce, zend_string *lcname, zval *delayed_early_binding);
40
41 void zend_inheritance_check_override(zend_class_entry *ce);
42
43 ZEND_API extern zend_class_entry* (*zend_inheritance_cache_get)(zend_class_entry *ce, zend_class_entry *parent, zend_class_entry **traits_and_interfaces);
44 ZEND_API extern zend_class_entry* (*zend_inheritance_cache_add)(zend_class_entry *ce, zend_class_entry *proto, zend_class_entry *parent, zend_class_entry **traits_and_interfaces, HashTable *dependencies);
45
46 typedef enum {
47 INHERITANCE_UNRESOLVED = -1,
48 INHERITANCE_ERROR = 0,
49 INHERITANCE_WARNING = 1,
50 INHERITANCE_SUCCESS = 2,
51 } zend_inheritance_status;
52
53 ZEND_API zend_inheritance_status zend_verify_property_hook_variance(const zend_property_info *prop_info, const zend_function *func);
54 ZEND_API ZEND_COLD ZEND_NORETURN void zend_hooked_property_variance_error(const zend_property_info *prop_info);
55 ZEND_API ZEND_COLD ZEND_NORETURN void zend_hooked_property_variance_error_ex(zend_string *value_param_name, zend_string *class_name, zend_string *prop_name);
56 ZEND_API void zend_verify_hooked_property(zend_class_entry *ce, zend_property_info *prop_info, zend_string *prop_name);
57
58 END_EXTERN_C()
59
60 #endif
61