Facebook\HackCodegen\CodegenClassish
Facebook\HackCodegen\CodegenClassish
Abstract class to generate class-like definitions
Interface Synopsis
namespace Facebook\HackCodegen;
abstract class CodegenClassish implements ICodeBuilderRenderer {...}
Public Methods
->__construct(IHackCodegenConfig $config, string $name)->addConstant(CodegenClassConstant $const): \this->addGeneric(string $decl): \this
Add a generic parameter->addGenericSubtypeConstraint(string $subtype, string $baseType): \this
Add a generic parameter with subtype constraint->addGenericSupertypeConstraint(string $superType, string $subtype): \this
Add a generic parameter with supertype constraint->addGenericf(\HH\Lib\Str\SprintfFormatString $format, \mixed ...$args): \this
Add a generic parameter using a %-placeholder format string->addGenerics(\ Traversable<string> $generics_decl): \this
Add generic parameters->addMethod(CodegenMethod $method): \this->addMethods(Traversable<CodegenMethod> $methods): \this->addProperties(Traversable<CodegenProperty> $vars): \this->addProperty(CodegenProperty $var): \this->addTrait(CodegenUsesTrait $trait): \this->addTraits(Traversable<CodegenUsesTrait> $traits): \this->addTypeConstant(CodegenTypeConstant $const): \this->appendToBuilder(HackBuilder $builder): HackBuilder
Append the entire declaration to aHackBuilder->getName(): string->setDocBlock(string $comment): \this->setGeneratedFrom(CodegenGeneratedFrom $from): \this->setHasManualDeclarations(bool $value = true, ?string $name = NULL, ?string $contents = NULL): \this
If value is set to true, the class will have a section for manually adding declarations, such as type constants->setHasManualMethodSection(bool $value = true, ?string $name = NULL, ?string $contents = NULL): \this
Set whether or not the class has a section to contain manually written or modified methods->setIsConsistentConstruct(bool $value = true): \this
Requires subclasses to have compatible constructors
Protected Methods
->appendBodyToBuilder(HackBuilder $builder): \void
Append just the body of the class (between{and}to aHackBuilder->buildConsts(HackBuilder $builder): \void->buildDeclaration(HackBuilder $builder): \void->buildGenericsDeclaration(): string->buildManualDeclarations(HackBuilder $builder): \void->buildMethods(HackBuilder $builder): \void->buildTraits(HackBuilder $builder): \void->buildVars(HackBuilder $builder): \void->getExtraAttributes(): dict<string, vec<string>>
Returns all the attributes defined on the class->getTraits(): vec<string>