---
layout: docs
title: addFunction
id: class.Facebook.HackCodegen.CodegenFile.addFunction
docid: class.Facebook.HackCodegen.CodegenFile.addFunction
permalink: /docs/reference/class.Facebook.HackCodegen.CodegenFile.addFunction/
---
# Facebook\\HackCodegen\\CodegenFile::addFunction()




``` Hack
public function addFunction(
  Facebook\HackCodegen\CodegenFunction $function,
): this;
```




## Parameters




+ [` Facebook\HackCodegen\CodegenFunction `](<class.Facebook.HackCodegen.CodegenFunction.md>)`` $function ``




## Returns




* ` this `