File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
phper-doc/doc/_06_module/_06_register_class Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -38,15 +38,19 @@ class Foo {}
3838
3939## Extends & implements
4040
41- To allow a class to extend another, you can either use ` ClassEntity.extends(StateClass<T>) ` for classes implemented
42- in your module.
41+ To allow a class to extend another, you can use ` ClassEntity.extends(StateClass<T>) ` for classes implemented
42+ in your module. A StateClass can either be obtained by registering your own class against the module, or
43+ by looking up the class by name (for example, for PHP built-in classes like ` Exception ` ).
4344
4445If you want class ` Foo ` extends ` Bar ` , and implements interface ` Stringable ` :
4546
4647``` rust,no_run
4748use phper::classes::{ClassEntity, ClassEntry, Interface};
49+ use phper::{modules::Module, php_get_module};
4850
49- let mut bar = ClassEntity::new("Bar").bind_class();
51+ let mut module = Module::new("test", "0.1", "");
52+
53+ let bar = module.add_class(ClassEntity::new("Bar"));
5054let mut foo = ClassEntity::new("Foo");
5155foo.extends(bar);
5256foo.implements(Interface::from_name("Stringable"));
You can’t perform that action at this time.
0 commit comments