Файл: vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php
Строк: 39
<?php declare(strict_types=1);
namespace PhpParserBuilder;
use PhpParser;
use PhpParserBuilderHelpers;
use PhpParserNode;
use PhpParserNodeStmt;
class Namespace_ extends Declaration
{
private $name;
private $stmts = [];
/**
* Creates a namespace builder.
*
* @param NodeName|string|null $name Name of the namespace
*/
public function __construct($name) {
$this->name = null !== $name ? BuilderHelpers::normalizeName($name) : null;
}
/**
* Adds a statement.
*
* @param Node|PhpParserBuilder $stmt The statement to add
*
* @return $this The builder instance (for fluid interface)
*/
public function addStmt($stmt) {
$this->stmts[] = BuilderHelpers::normalizeStmt($stmt);
return $this;
}
/**
* Returns the built node.
*
* @return StmtNamespace_ The built node
*/
public function getNode() : Node {
return new StmtNamespace_($this->name, $this->stmts, $this->attributes);
}
}