import { PhpAttributes } from '../base'; import { PhpArg } from '../arguments'; import { PhpAttrGroup } from '../attributes'; import { PhpIdentifier } from '../identifier'; import { PhpName } from '../name'; import { PhpParam } from '../params'; import { PhpStmt } from '../stmt'; import { PhpType } from '../types'; import { PhpExprArrayItem, PhpExprArray, PhpExpr, PhpExprConstFetch, PhpExprVariable, PhpExprAssign, PhpExprArrayDimFetch, PhpExprMethodCall, PhpExprNullsafeMethodCall, PhpExprStaticCall, PhpExprFuncCall, PhpExprNew, PhpExprPropertyFetch, PhpExprNullsafePropertyFetch, PhpExprBooleanNot, PhpExprBinaryOp, PhpExprInstanceof, PhpExprCastArray, PhpExprCastScalar, PhpClosureUse, PhpExprClosure, PhpExprArrowFunction, PhpExprTernary, PhpMatchArm, PhpExprMatch, PhpExprThrow } from './types'; /** * Builds a PHP array expression node. * * @category PHP AST * @param items - An array of `PhpExprArrayItem` nodes. * @param attributes - Optional attributes for the node. * @returns A `PhpExprArray` node. */ export declare function buildArray(items: PhpExprArrayItem[], attributes?: PhpAttributes): PhpExprArray; /** * Builds a PHP array item node. * * @category PHP AST * @param value - The expression representing the item's value. * @param options - Optional configuration for the array item (key, by reference, unpack). * @param options.key * @param options.byRef * @param options.unpack * @param attributes - Optional attributes for the node. * @returns A `PhpExprArrayItem` node. */ export declare function buildArrayItem(value: PhpExpr, options?: { key?: PhpExpr | null; byRef?: boolean; unpack?: boolean; }, attributes?: PhpAttributes): PhpExprArrayItem; /** * Builds a PHP boolean scalar expression (represented as a `ConstFetch` of `true` or `false`). * * @category PHP AST * @param value - The boolean value. * @param attributes - Optional attributes for the node. * @returns A `PhpExprConstFetch` node representing the boolean scalar. */ export declare function buildScalarBool(value: boolean, attributes?: PhpAttributes): PhpExprConstFetch; /** * Builds a PHP `null` constant fetch expression. * * @category PHP AST * @param attributes - Optional attributes for the node. * @returns A `PhpExprConstFetch` node representing `null`. */ export declare function buildNull(attributes?: PhpAttributes): PhpExprConstFetch; /** * Builds a PHP variable expression node. * * @category PHP AST * @param name - The name of the variable, either a string or a `PhpExpr` for dynamic variable names. * @param attributes - Optional attributes for the node. * @returns A `PhpExprVariable` node. */ export declare function buildVariable(name: string | PhpExpr, attributes?: PhpAttributes): PhpExprVariable; /** * Builds a PHP assignment expression node. * * @category PHP AST * @param variable - The variable being assigned to. * @param expr - The expression whose value is being assigned. * @param attributes - Optional attributes for the node. * @returns A `PhpExprAssign` node. */ export declare function buildAssign(variable: PhpExpr, expr: PhpExpr, attributes?: PhpAttributes): PhpExprAssign; /** * Builds a PHP array dimension fetch expression node. * * @category PHP AST * @param variable - The array variable. * @param dim - The dimension (key) being accessed, or `null` for appending. * @param attributes - Optional attributes for the node. * @returns A `PhpExprArrayDimFetch` node. */ export declare function buildArrayDimFetch(variable: PhpExpr, dim: PhpExpr | null, attributes?: PhpAttributes): PhpExprArrayDimFetch; /** * Builds a PHP method call expression node. * * @category PHP AST * @param variable - The variable or expression representing the object. * @param name - The name of the method, either an identifier or an expression. * @param args - An array of `PhpArg` nodes representing the method arguments. * @param attributes - Optional attributes for the node. * @returns A `PhpExprMethodCall` node. */ export declare function buildMethodCall(variable: PhpExpr, name: PhpIdentifier | PhpExpr, args?: PhpArg[], attributes?: PhpAttributes): PhpExprMethodCall; /** * Builds a PHP nullsafe method call expression node. * * @category PHP AST * @param variable - The variable or expression representing the object. * @param name - The name of the method, either an identifier or an expression. * @param args - An array of `PhpArg` nodes representing the method arguments. * @param attributes - Optional attributes for the node. * @returns A `PhpExprNullsafeMethodCall` node. */ export declare function buildNullsafeMethodCall(variable: PhpExpr, name: PhpIdentifier | PhpExpr, args?: PhpArg[], attributes?: PhpAttributes): PhpExprNullsafeMethodCall; /** * Builds a PHP static method call expression node. * * @category PHP AST * @param className - The name of the class, either a `PhpName` or an expression. * @param name - The name of the static method, either an identifier or an expression. * @param args - An array of `PhpArg` nodes representing the method arguments. * @param attributes - Optional attributes for the node. * @returns A `PhpExprStaticCall` node. */ export declare function buildStaticCall(className: PhpName | PhpExpr, name: PhpIdentifier | PhpExpr, args?: PhpArg[], attributes?: PhpAttributes): PhpExprStaticCall; /** * Builds a PHP function call expression node. * * @category PHP AST * @param name - The name of the function, either a `PhpName` or an expression. * @param args - An array of `PhpArg` nodes representing the function arguments. * @param attributes - Optional attributes for the node. * @returns A `PhpExprFuncCall` node. */ export declare function buildFuncCall(name: PhpName | PhpExpr, args?: PhpArg[], attributes?: PhpAttributes): PhpExprFuncCall; /** * Builds a PHP `new` expression node. * * @category PHP AST * @param className - The name of the class to instantiate, either a `PhpName` or an expression. * @param args - An array of `PhpArg` nodes representing the constructor arguments. * @param attributes - Optional attributes for the node. * @returns A `PhpExprNew` node. */ export declare function buildNew(className: PhpName | PhpExpr, args?: PhpArg[], attributes?: PhpAttributes): PhpExprNew; /** * Builds a PHP property fetch expression node. * * @category PHP AST * @param variable - The variable or expression representing the object. * @param name - The name of the property, either an identifier or an expression. * @param attributes - Optional attributes for the node. * @returns A `PhpExprPropertyFetch` node. */ export declare function buildPropertyFetch(variable: PhpExpr, name: PhpIdentifier | PhpExpr, attributes?: PhpAttributes): PhpExprPropertyFetch; /** * Builds a PHP nullsafe property fetch expression node. * * @category PHP AST * @param variable - The variable or expression representing the object. * @param name - The name of the property, either an identifier or an expression. * @param attributes - Optional attributes for the node. * @returns A `PhpExprNullsafePropertyFetch` node. */ export declare function buildNullsafePropertyFetch(variable: PhpExpr, name: PhpIdentifier | PhpExpr, attributes?: PhpAttributes): PhpExprNullsafePropertyFetch; /** * Builds a PHP boolean NOT expression node. * * @category PHP AST * @param expr - The expression to negate. * @param attributes - Optional attributes for the node. * @returns A `PhpExprBooleanNot` node. */ export declare function buildBooleanNot(expr: PhpExpr, attributes?: PhpAttributes): PhpExprBooleanNot; /** * Represents the type of a PHP binary operator. * * @category PHP AST */ export type PhpBinaryOperator = 'Plus' | 'Minus' | 'Mul' | 'Div' | 'Mod' | 'BooleanAnd' | 'BooleanOr' | 'Smaller' | 'SmallerOrEqual' | 'Greater' | 'GreaterOrEqual' | 'Equal' | 'NotEqual' | 'Identical' | 'NotIdentical' | 'Concat'; /** * Builds a PHP binary operation expression node. * * @category PHP AST * @param operator - The binary operator (e.g., 'Plus', 'BooleanAnd'). * @param left - The left-hand side expression. * @param right - The right-hand side expression. * @param attributes - Optional attributes for the node. * @returns A `PhpExprBinaryOp` node. */ export declare function buildBinaryOperation(operator: PhpBinaryOperator, left: PhpExpr, right: PhpExpr, attributes?: PhpAttributes): PhpExprBinaryOp; /** * Builds a PHP `instanceof` expression node. * * @category PHP AST * @param expr - The expression to check. * @param className - The class name to check against, either a `PhpName` or an expression. * @param attributes - Optional attributes for the node. * @returns A `PhpExprInstanceof` node. */ export declare function buildInstanceof(expr: PhpExpr, className: PhpName | PhpExpr, attributes?: PhpAttributes): PhpExprInstanceof; /** * Builds a PHP array cast expression node. * * @category PHP AST * @param expr - The expression to cast to an array. * @param attributes - Optional attributes for the node. * @returns A `PhpExprCastArray` node. */ export declare function buildArrayCast(expr: PhpExpr, attributes?: PhpAttributes): PhpExprCastArray; /** * Builds a PHP scalar cast expression node (int, float, string, bool). * * @category PHP AST * @param kind - The type to cast to ('int', 'float', 'string', or 'bool'). * @param expr - The expression to cast. * @param attributes - Optional attributes for the node. * @returns A `PhpExprCastScalar` node. */ export declare function buildScalarCast(kind: 'int' | 'float' | 'string' | 'bool', expr: PhpExpr, attributes?: PhpAttributes): PhpExprCastScalar; /** * Builds a PHP closure use node. * * @category PHP AST * @param variable - The variable being used in the closure. * @param options - Optional configuration for the use (by reference). * @param options.byRef * @param attributes - Optional attributes for the node. * @returns A `PhpClosureUse` node. */ export declare function buildClosureUse(variable: PhpExprVariable, options?: { byRef?: boolean; }, attributes?: PhpAttributes): PhpClosureUse; /** * Builds a PHP closure expression node. * * @category PHP AST * @param options - Optional configuration for the closure (static, by reference, parameters, uses, return type, statements, attribute groups). * @param options.static * @param options.byRef * @param options.params * @param options.uses * @param options.returnType * @param options.stmts * @param options.attrGroups * @param attributes - Optional attributes for the node. * @returns A `PhpExprClosure` node. */ export declare function buildClosure(options?: { static?: boolean; byRef?: boolean; params?: PhpParam[]; uses?: PhpClosureUse[]; returnType?: PhpType | null; stmts?: PhpStmt[]; attrGroups?: PhpAttrGroup[]; }, attributes?: PhpAttributes): PhpExprClosure; /** * Builds a PHP arrow function expression node. * * @category PHP AST * @param options - Configuration for the arrow function (static, by reference, parameters, return type, expression body, attribute groups). * @param options.static * @param options.byRef * @param options.params * @param options.returnType * @param options.expr * @param options.attrGroups * @param attributes - Optional attributes for the node. * @returns A `PhpExprArrowFunction` node. */ export declare function buildArrowFunction(options: { static?: boolean; byRef?: boolean; params?: PhpParam[]; returnType?: PhpType | null; expr: PhpExpr; attrGroups?: PhpAttrGroup[]; }, attributes?: PhpAttributes): PhpExprArrowFunction; /** * Builds a PHP ternary expression node. * * @category PHP AST * @param cond - The conditional expression. * @param ifExpr - The expression to evaluate if the condition is true (can be `null` for shorthand ternary). * @param elseExpr - The expression to evaluate if the condition is false. * @param attributes - Optional attributes for the node. * @returns A `PhpExprTernary` node. */ export declare function buildTernary(cond: PhpExpr, ifExpr: PhpExpr | null, elseExpr: PhpExpr, attributes?: PhpAttributes): PhpExprTernary; /** * Builds a PHP match arm node. * * @category PHP AST * @param conds - An array of expressions representing the conditions for this arm, or `null` for the default arm. * @param body - The expression to execute if the conditions match. * @param attributes - Optional attributes for the node. * @returns A `PhpMatchArm` node. */ export declare function buildMatchArm(conds: PhpExpr[] | null, body: PhpExpr, attributes?: PhpAttributes): PhpMatchArm; /** * Builds a PHP `match` expression node. * * @category PHP AST * @param cond - The expression to match against. * @param arms - An array of `PhpMatchArm` nodes. * @param attributes - Optional attributes for the node. * @returns A `PhpExprMatch` node. */ export declare function buildMatch(cond: PhpExpr, arms: PhpMatchArm[], attributes?: PhpAttributes): PhpExprMatch; /** * Builds a PHP `throw` expression node. * * @category PHP AST * @param expr - The expression representing the throwable object. * @param attributes - Optional attributes for the node. * @returns A `PhpExprThrow` node. */ export declare function buildThrow(expr: PhpExpr, attributes?: PhpAttributes): PhpExprThrow; export * from './types';