name = $name; } /** * Adds a statement. * * @param Stmt|PhpParser\Builder $stmt The statement to add * * @return $this The builder instance (for fluid interface) */ public function addStmt($stmt) { $stmt = $this->normalizeNode($stmt); if (!$stmt instanceof Stmt\ClassMethod) { throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); } $this->methods[] = $stmt; return $this; } /** * Returns the built trait node. * * @return Stmt\Trait_ The built interface node */ public function getNode() { return new Stmt\Trait_($this->name, $this->methods, $this->attributes); } }