@wpkernel/php-json-ast v0.12.6-beta.3
@wpkernel/php-json-ast / buildNode
Function: buildNode()
ts
function buildNode<T>(
nodeType,
props,
attributes?): T;Generic factory helper for PHP AST node construction.
Prefer dedicated builders exported alongside the node interfaces for specific node types. Use this generic builder for niche constructs that do not yet have a typed factory.
Type Parameters
T
T extends PhpNode
Parameters
nodeType
T["nodeType"]
The type of the PHP AST node.
props
Omit<T, "nodeType" | "attributes">
The properties of the node, excluding nodeType and attributes.
attributes?
Readonly<Record<string, unknown>>
Optional attributes for the node.
Returns
T
A new PHP AST node of the specified type.
