File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 - id : classes-codegen-class-base
2222 - id : classes-codegen-interface
2323 - id : classes-codegen-class
24+ - id : classes-codegen-trait
2425 - id : classes-codegen-enum
2526
2627# n title:, 1 items: per title:, n id: per items:
Original file line number Diff line number Diff line change 1+ ---
2+ docid : classes-codegen-trait
3+ title : CodegenTrait
4+ layout : docs
5+ permalink : /docs/classes/CodegenTrait/
6+ ---
7+
8+ A ` CodegenTrait ` is created with ` $factory->codegenInterface(name) ` ; it can
9+ be marked as implementing interfaces with
10+ ` ->addInterface($codegen_implements_interface) ` , and also adds two Hack-specific
11+ features on top of ` CodegenBaseClass ` :
12+
13+ - ` ->addRequireClass(string $class) ` : only allow the trait to be used by ` $class `
14+ or subclasses of ` $class ` .
15+ - ` ->addRequireInterface(string $class) ` : only allow the trait to be used classes
16+ that implement the specified interface.
You can’t perform that action at this time.
0 commit comments