function Interface_::addStmt
Adds a statement.
Parameters
Stmt|PhpParser\Builder $stmt The statement to add:
Return value
$this The builder instance (for fluid interface)
Overrides Declaration::addStmt
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Builder/ Interface_.php, line 53
Class
Namespace
PhpParser\BuilderCode
public function addStmt($stmt) {
$stmt = BuilderHelpers::normalizeNode($stmt);
if ($stmt instanceof Stmt\ClassConst) {
$this->constants[] = $stmt;
}
elseif ($stmt instanceof Stmt\ClassMethod) {
// we erase all statements in the body of an interface method
$stmt->stmts = null;
$this->methods[] = $stmt;
}
else {
throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
}
return $this;
}