function BuilderHelpers::normalizeStmt
Normalizes a node to a statement.
Expressions are wrapped in a Stmt\Expression node.
Parameters
Node|Builder $node The node to normalize:
Return value
Stmt The normalized statement node
3 calls to BuilderHelpers::normalizeStmt()
- Function_::addStmt in vendor/
nikic/ php-parser/ lib/ PhpParser/ Builder/ Function_.php - Adds a statement.
- Method::addStmt in vendor/
nikic/ php-parser/ lib/ PhpParser/ Builder/ Method.php - Adds a statement.
- Namespace_::addStmt in vendor/
nikic/ php-parser/ lib/ PhpParser/ Builder/ Namespace_.php - Adds a statement.
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ BuilderHelpers.php, line 48
Class
- BuilderHelpers
- This class defines helpers used in the implementation of builders. Don't use it directly.
Namespace
PhpParserCode
public static function normalizeStmt($node) : Stmt {
$node = self::normalizeNode($node);
if ($node instanceof Stmt) {
return $node;
}
if ($node instanceof Expr) {
return new Stmt\Expression($node);
}
throw new \LogicException('Expected statement or expression node');
}