1 <?php declare(strict_types=1);
3 namespace PhpParser\Builder;
6 use PhpParser\BuilderHelpers;
8 abstract class Declaration implements PhpParser\Builder
10 protected $attributes = [];
12 abstract public function addStmt($stmt);
15 * Adds multiple statements.
17 * @param array $stmts The statements to add
19 * @return $this The builder instance (for fluid interface)
21 public function addStmts(array $stmts) {
22 foreach ($stmts as $stmt) {
23 $this->addStmt($stmt);
30 * Sets doc comment for the declaration.
32 * @param PhpParser\Comment\Doc|string $docComment Doc comment to set
34 * @return $this The builder instance (for fluid interface)
36 public function setDocComment($docComment) {
37 $this->attributes['comments'] = [
38 BuilderHelpers::normalizeDocComment($docComment)