pub enum Atomic {
Show 53 variants
TString,
TLiteralString(Arc<str>),
TCallableString,
TClassString(Option<Name>),
TNonEmptyString,
TNonFalsyString,
TNumericString,
TRefinedString {
refinement: StringRefinement,
non_empty: bool,
},
TInt,
TLiteralInt(i64),
TIntRange {
min: Option<i64>,
max: Option<i64>,
},
TPositiveInt,
TNegativeInt,
TNonNegativeInt,
TRefinedInt(IntRefinement),
TFloat,
TIntegralFloat,
TLiteralFloat(i64, i64),
TBool,
TTrue,
TFalse,
TNull,
TVoid,
TNever,
TMixed,
TScalar,
TNumeric,
TObject,
TNamedObject {
fqcn: Name,
type_params: Arc<[Type]>,
},
TStaticObject {
fqcn: Name,
},
TSelf {
fqcn: Name,
},
TParent {
fqcn: Name,
},
TCallable {
params: Option<Box<Vec<FnParam>>>,
return_type: Option<Box<Type>>,
is_pure: bool,
},
TClosure {
data: Box<ClosureData>,
},
TArray {
key: Box<Type>,
value: Box<Type>,
},
TList {
value: Box<Type>,
},
TNonEmptyArray {
key: Box<Type>,
value: Box<Type>,
},
TNonEmptyList {
value: Box<Type>,
},
TKeyedArray {
properties: Arc<KeyedProperties>,
is_open: bool,
is_list: bool,
},
TTemplateParam {
name: Name,
as_type: Box<Type>,
defining_entity: Name,
},
TKeyOf {
target: Box<Type>,
},
TValueOf {
target: Box<Type>,
},
TConditional {
data: Box<ConditionalData>,
},
TInterfaceString(Option<Name>),
TEnumString,
TTraitString,
TLiteralEnumCase {
enum_fqcn: Name,
case_name: Name,
},
TIntersection {
parts: Arc<[Type]>,
},
TObjectShape {
properties: Arc<KeyedProperties>,
},
TResource,
TClosedResource,
TOpenResource,
TPropertiesOf {
class: Name,
filter: PropertyFilter,
},
}Variants§
TString
string
TLiteralString(Arc<str>)
"hello" — a specific string literal
TCallableString
callable-string — a string containing a callable name
TClassString(Option<Name>)
class-string or class-string<T>
TNonEmptyString
non-empty-string
TNonFalsyString
non-falsy-string — neither "" nor "0"
TNumericString
numeric-string
TRefinedString
lowercase-string, uppercase-string, literal-string and their non-empty- forms.
TInt
int
TLiteralInt(i64)
42 — a specific integer literal
TIntRange
int<min, max> — bounded integer range
TPositiveInt
positive-int
TNegativeInt
negative-int
TNonNegativeInt
non-negative-int
TRefinedInt(IntRefinement)
literal-int or an unresolved int-mask-of<Cls::*>.
TFloat
float
TIntegralFloat
float that is always integral (whole-number value, no fractional part).
Returned by floor(), ceil(), and zero-precision round(). Can be passed to int
parameters without ImplicitFloatToIntCast because the conversion is lossless.
TLiteralFloat(i64, i64)
3.14 — a specific float literal
TBool
bool
TTrue
true
TFalse
false
TNull
null
TVoid
void — return-only; can’t be used as a value
TNever
never — function that never returns (throws or infinite loop)
TMixed
mixed — top type; accepts anything
TScalar
scalar — int | float | string | bool
TNumeric
numeric — int | float | numeric-string
TObject
object — any object
TNamedObject
ClassName / ClassName<T1, T2> — specific named class/interface
TStaticObject
static — late static binding type; resolved to calling class at call site
TSelf
self — the class in whose body the type appears
TParent
parent — the parent class
TCallable
callable or callable(T): R
Fields
TClosure
Closure or Closure(T): R — more specific than TCallable.
Payload boxed to keep Atomic at 32 bytes (see ClosureData).
Fields
data: Box<ClosureData>TArray
array or array<K, V>
TList
list<T> — integer-keyed sequential array (keys 0, 1, 2, …)
TNonEmptyArray
non-empty-array<K, V>
TNonEmptyList
non-empty-list<T>
TKeyedArray
array{key: T, ...} — shape / keyed array
Fields
properties: Arc<KeyedProperties>Shared so cloning a shape copies a pointer and equal clones compare by address.
TTemplateParam
T — a template type parameter
Fields
TKeyOf
key-of<T> — preserved when the operand cannot yet be reduced.
TValueOf
value-of<T> — preserved when the operand cannot yet be reduced.
TConditional
($param is TypeName ? A : B) — conditional type.
Payload boxed to keep Atomic at 32 bytes (see ConditionalData).
Fields
data: Box<ConditionalData>TInterfaceString(Option<Name>)
interface-string or interface-string<T>
TEnumString
enum-string
TTraitString
trait-string
TLiteralEnumCase
EnumName::CaseName — a specific enum case literal
TIntersection
A&B&C — PHP 8.1+ pure intersection type
TObjectShape
object{prop: T, ...} — an object with these public properties.
Fields
properties: Arc<KeyedProperties>TResource
resource — a legacy resource handle (open or closed); docblock-only, never a native type.
TClosedResource
closed-resource — a handle known to be closed, as after fclose().
TOpenResource
open-resource — a handle not known to be closed; rejects only closed-resource.
TPropertiesOf
properties-of<Cls> and its visibility-filtered forms: a shape built from the class when checked.
Implementations§
Source§impl Atomic
impl Atomic
Sourcepub fn can_be_falsy(&self) -> bool
pub fn can_be_falsy(&self) -> bool
Whether this atomic type can ever evaluate to a falsy value.
Sourcepub fn is_deferred(&self) -> bool
pub fn is_deferred(&self) -> bool
A template parameter or a key-of/value-of over one: its concrete type is unknown here.
Sourcepub fn can_be_truthy(&self) -> bool
pub fn can_be_truthy(&self) -> bool
Whether this atomic type can ever evaluate to a truthy value.
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Whether this atomic represents a numeric type (int, float, or numeric-string).
Sourcepub fn is_definitely_non_object(&self) -> bool
pub fn is_definitely_non_object(&self) -> bool
Whether this atomic can never be an object instance — so clone-ing it
is invalid. Conservative: ambiguous atomics (mixed, callable,
never, conditionals, template params, enum cases, intersections,
object types) all return false so they never trigger a false positive.
Sourcepub fn is_callable(&self) -> bool
pub fn is_callable(&self) -> bool
Whether this atomic is a callable variant.
TCallableString is included: it denotes a string known to be a
valid callable, so !is_callable() must remove it from the type.
Sourcepub fn named_object_fqcn(&self) -> Option<&str>
pub fn named_object_fqcn(&self) -> Option<&str>
Returns the FQCN if this is a named object type.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Atomic
impl<'de> Deserialize<'de> for Atomic
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Atomic
impl StructuralPartialEq for Atomic
Auto Trait Implementations§
impl Forget for Atomic
impl Freeze for Atomicwhere
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const u8 is !null: Freeze,
*const ArcInner<[Type]> is !null: Freeze,
PhantomData<ArcInner<[Type]>>: Freeze,
*const Vec<FnParam> is !null: Freeze,
PhantomData<Vec<FnParam>>: Freeze,
*const Type is !null: Freeze,
PhantomData<Type>: Freeze,
*const ClosureData is !null: Freeze,
PhantomData<ClosureData>: Freeze,
*const ArcInner<KeyedProperties> is !null: Freeze,
PhantomData<ArcInner<KeyedProperties>>: Freeze,
*const ConditionalData is !null: Freeze,
PhantomData<ConditionalData>: Freeze,
impl Move for Atomic
impl RefUnwindSafe for Atomic
impl Send for Atomic
impl Sync for Atomic
impl Unpin for Atomic
impl UnsafeUnpin for Atomicwhere
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
*const ArcInner<[Type]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[Type]>>: UnsafeUnpin,
*const Vec<FnParam> is !null: UnsafeUnpin,
PhantomData<Vec<FnParam>>: UnsafeUnpin,
*const Type is !null: UnsafeUnpin,
PhantomData<Type>: UnsafeUnpin,
*const ClosureData is !null: UnsafeUnpin,
PhantomData<ClosureData>: UnsafeUnpin,
*const ArcInner<KeyedProperties> is !null: UnsafeUnpin,
PhantomData<ArcInner<KeyedProperties>>: UnsafeUnpin,
*const ConditionalData is !null: UnsafeUnpin,
PhantomData<ConditionalData>: UnsafeUnpin,
impl UnwindSafe for Atomicwhere
Arc<str>: UnwindSafe,
NonNull<u8>: UnwindSafe,
Arc<[Type]>: UnwindSafe,
BoxRaw<Vec<FnParam>>: UnwindSafe,
BoxRaw<Type>: UnwindSafe,
BoxRaw<ClosureData>: UnwindSafe,
Arc<KeyedProperties>: UnwindSafe,
BoxRaw<ConditionalData>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.