Skip to main content

TypeHintKind

Enum TypeHintKind 

Source
pub enum TypeHintKind<'arena, 'src> {
    Named(Name<'arena, 'src>),
    Keyword(BuiltinType, Span),
    Nullable(&'arena TypeHint<'arena, 'src>),
    Union(ArenaVec<'arena, TypeHint<'arena, 'src>>),
    Intersection(ArenaVec<'arena, TypeHint<'arena, 'src>>),
}
Expand description

A PHP type hint.

Keyword is the fast path for the 20 built-in type names (int, string, bool, self, array, etc.). It stores only a 1-byte discriminant and a Span, avoiding the Cow<str> that Named(Name::Simple) would require.

Serialises identically to Named so all existing snapshots remain unchanged.

Variants§

§

Named(Name<'arena, 'src>)

§

Keyword(BuiltinType, Span)

Built-in type keyword — serialises as Named for snapshot compatibility.

§

Nullable(&'arena TypeHint<'arena, 'src>)

§

Union(ArenaVec<'arena, TypeHint<'arena, 'src>>)

§

Intersection(ArenaVec<'arena, TypeHint<'arena, 'src>>)

Trait Implementations§

Source§

impl<'arena, 'src> Debug for TypeHintKind<'arena, 'src>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'arena, 'src> Serialize for TypeHintKind<'arena, 'src>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'arena, 'src> Freeze for TypeHintKind<'arena, 'src>

§

impl<'arena, 'src> !RefUnwindSafe for TypeHintKind<'arena, 'src>

§

impl<'arena, 'src> !Send for TypeHintKind<'arena, 'src>

§

impl<'arena, 'src> !Sync for TypeHintKind<'arena, 'src>

§

impl<'arena, 'src> Unpin for TypeHintKind<'arena, 'src>

§

impl<'arena, 'src> UnsafeUnpin for TypeHintKind<'arena, 'src>

§

impl<'arena, 'src> !UnwindSafe for TypeHintKind<'arena, 'src>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.