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




``` Hack
public function addTrait(
  Facebook\HackCodegen\CodegenUsesTrait $trait,
): this;
```




## Parameters




+ [` Facebook\HackCodegen\CodegenUsesTrait `](<class.Facebook.HackCodegen.CodegenUsesTrait.md>)`` $trait ``




## Returns




* ` this `