'int', 'y' => 'int')) */ final class CodegenShape implements ICodeBuilderRenderer { use HackBuilderRenderer; private ?string $manualAttrsID = null; public function __construct( private array $attrs = array(), ) {} public function setManualAttrsID(?string $id = null): this { $this->manualAttrsID = $id; return $this; } public function appendToBuilder(HackBuilder $builder): HackBuilder { $builder ->addLine('shape(') ->indent(); foreach ($this->attrs as $name => $type) { $builder->addLine("'%s' => %s,", $name, $type); } $manual_id = $this->manualAttrsID; if ($manual_id !== null) { $builder ->ensureNewLine() ->beginManualSection($manual_id) ->ensureEmptyLine() ->endManualSection(); } return $builder ->unindent() ->add(')'); } } function codegen_shape(array $attrs = array()): CodegenShape { return new CodegenShape($attrs); }