#[non_exhaustive]pub struct Param<'arena, 'src> {Show 13 fields
pub name: Ident<'src>,
pub type_hint: Option<TypeHint<'arena, 'src>>,
pub default: Option<Expr<'arena, 'src>>,
pub by_ref: bool,
pub variadic: bool,
pub is_readonly: bool,
pub is_final: bool,
pub visibility: Option<Visibility>,
pub set_visibility: Option<Visibility>,
pub attributes: ArenaVec<'arena, Attribute<'arena, 'src>>,
pub hooks: ArenaVec<'arena, PropertyHook<'arena, 'src>>,
pub doc_comment: Option<Comment<'src>>,
pub span: Span,
}Expand description
A function, method, closure or hook parameter.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: Ident<'src>Parameter name without $.
type_hint: Option<TypeHint<'arena, 'src>>Declared parameter type.
default: Option<Expr<'arena, 'src>>Default value expression.
by_ref: booltrue when by reference (&).
variadic: booltrue for a variadic parameter (...$x).
is_readonly: booltrue for a readonly promoted property.
is_final: booltrue for a final promoted property.
visibility: Option<Visibility>Visibility of a promoted constructor property.
set_visibility: Option<Visibility>Asymmetric write visibility, e.g. private(set) (PHP 8.4+).
attributes: ArenaVec<'arena, Attribute<'arena, 'src>>#[...] attributes applied to this node.
hooks: ArenaVec<'arena, PropertyHook<'arena, 'src>>Property hooks on a promoted property (PHP 8.4+).
doc_comment: Option<Comment<'src>>A doc-block attached directly to this parameter (PHP 8.6 recognizes this for reflection purposes), either immediately before it or trailing it up to the comma. Parsed at every version since a bare comment is legal PHP regardless of target version.
span: SpanSource range of this node.
Implementations§
Source§impl<'arena, 'src> Param<'arena, 'src>
impl<'arena, 'src> Param<'arena, 'src>
Sourcepub fn new(arena: &'arena Bump, name: Ident<'src>, span: Span) -> Self
pub fn new(arena: &'arena Bump, name: Ident<'src>, span: Span) -> Self
A parameter with name and span set and every other field empty
(None, false, no attributes or hooks). The fields are public, so set
the rest by assignment; Param is #[non_exhaustive] and cannot be
built with a struct literal outside this crate.