pub enum PHPExpr {
Show 22 variants
Lit(String),
Var(String),
BinOp(Box<PHPExpr>, String, Box<PHPExpr>),
UnaryOp(String, Box<PHPExpr>),
FuncCall(String, Vec<PHPExpr>),
ArrayLit(Vec<PHPExpr>),
ArrayMap(Vec<(PHPExpr, PHPExpr)>),
New(String, Vec<PHPExpr>),
Arrow(Box<PHPExpr>, String),
NullSafe(Box<PHPExpr>, String),
StaticAccess(String, String),
Index(Box<PHPExpr>, Box<PHPExpr>),
Ternary(Box<PHPExpr>, Box<PHPExpr>, Box<PHPExpr>),
NullCoalesce(Box<PHPExpr>, Box<PHPExpr>),
Closure {
params: Vec<PHPParam>,
use_vars: Vec<String>,
return_type: Option<PHPType>,
body: Vec<String>,
},
ArrowFn {
params: Vec<PHPParam>,
return_type: Option<PHPType>,
body: Box<PHPExpr>,
},
Match {
subject: Box<PHPExpr>,
arms: Vec<(PHPExpr, PHPExpr)>,
default: Option<Box<PHPExpr>>,
},
NamedArg(String, Box<PHPExpr>),
Spread(Box<PHPExpr>),
Cast(String, Box<PHPExpr>),
Isset(Box<PHPExpr>),
Empty(Box<PHPExpr>),
}Expand description
PHP expression AST node.
Variants§
Lit(String)
Literal value (int, float, string, bool, null)
Var(String)
Variable reference: $name
BinOp(Box<PHPExpr>, String, Box<PHPExpr>)
Binary operation: lhs op rhs
UnaryOp(String, Box<PHPExpr>)
Unary operation: op operand
FuncCall(String, Vec<PHPExpr>)
Function/method call: name(args...)
ArrayLit(Vec<PHPExpr>)
Array literal: [expr, ...]
ArrayMap(Vec<(PHPExpr, PHPExpr)>)
Associative array literal: [key => val, ...]
New(String, Vec<PHPExpr>)
Object instantiation: new ClassName(args...)
Arrow(Box<PHPExpr>, String)
Property access: $obj->prop
NullSafe(Box<PHPExpr>, String)
Null-safe property access: $obj?->prop
StaticAccess(String, String)
Static property/method access: Class::member
Index(Box<PHPExpr>, Box<PHPExpr>)
Array index: $arr[idx]
Ternary(Box<PHPExpr>, Box<PHPExpr>, Box<PHPExpr>)
Ternary: $cond ? $then : $else
NullCoalesce(Box<PHPExpr>, Box<PHPExpr>)
Null coalescing: $a ?? $b
Closure
Closure / anonymous function
ArrowFn
Arrow function (PHP 7.4+): fn($x) => expr
Match
Match expression (PHP 8.0+)
NamedArg(String, Box<PHPExpr>)
Named argument: name: value
Spread(Box<PHPExpr>)
Spread operator: ...$arr
Cast(String, Box<PHPExpr>)
Cast: (type)$expr
Isset(Box<PHPExpr>)
isset($var)
Empty(Box<PHPExpr>)
empty($var)
Trait Implementations§
impl StructuralPartialEq for PHPExpr
Auto Trait Implementations§
impl Freeze for PHPExpr
impl RefUnwindSafe for PHPExpr
impl Send for PHPExpr
impl Sync for PHPExpr
impl Unpin for PHPExpr
impl UnsafeUnpin for PHPExpr
impl UnwindSafe for PHPExpr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more