pub enum TypeKind {
Show 21 variants
Union {
kinds: Vec<TypeKind>,
},
Intersection {
kinds: Vec<TypeKind>,
},
Scalar(ScalarTypeKind),
Object(ObjectTypeKind),
Array(ArrayTypeKind),
Callable(CallableTypeKind),
Value(ValueTypeKind),
Conditional {
parameter: Box<TypeKind>,
condition: Box<TypeKind>,
then: Box<TypeKind>,
otherwise: Box<TypeKind>,
},
KeyOf {
kind: Box<TypeKind>,
},
ValueOf {
kind: Box<TypeKind>,
},
PropertiesOf {
kind: Box<TypeKind>,
},
ClassStringMap {
key: Template,
value_kind: Box<TypeKind>,
},
Index {
base_kind: Box<TypeKind>,
index_kind: Box<TypeKind>,
},
Variable {
name: StringIdentifier,
},
Iterable {
key: Box<TypeKind>,
value: Box<TypeKind>,
},
Void,
Resource,
ClosedResource,
Mixed {
explicit: bool,
},
Never,
GenericParameter {
name: StringIdentifier,
of: Box<TypeKind>,
defined_in: StringIdentifier,
},
}Expand description
Represents all possible types in the PHP static analyzer.
Variants§
Union
A union type, representing a value that can be any of the included types.
For example, T | U.
Intersection
An intersection type, representing a value that satisfies all of the included types.
For example, T & U.
Scalar(ScalarTypeKind)
A scalar type, such as int, string, bool, or specialized scalar types.
Object(ObjectTypeKind)
An object type, including specific instances and generic types.
Array(ArrayTypeKind)
An array type, including lists, shapes, and arrays with specified key and value types.
Callable(CallableTypeKind)
A callable type, representing functions, methods, and closures.
Value(ValueTypeKind)
A value type, including literals like strings, integers, and class constants.
Conditional
A conditional type, used for type inference based on a condition.
For example, T extends U ? V : W.
Fields
KeyOf
Represents the keys of a type.
For example, key-of<T> extracts the keys from type T.
ValueOf
Represents the values of a type.
For example, value-of<T> extracts the values from type T.
PropertiesOf
Represents the properties of a type.
For example, properties-of<T> extracts the properties from type T.
ClassStringMap
A class-string-map type, mapping class strings to values of a specified type.
For example, class-string-map<T of Foo, T> maps class names extending Foo to values of type T.
Fields
Index
An indexed access type, representing the type at a specific key.
For example, T[K] accesses the type of property K in type T.
Variable
A variable type, representing a type associated with a variable.
For example, $foo.
Fields
name: StringIdentifierIterable
An iterable type with specified key and value types.
For example, iterable<string, int>.
Void
The void type, representing the absence of a value.
Resource
The resource type, representing a resource handle.
ClosedResource
The closed-resource type, representing a resource that has been closed (e.g., using fclose()).
Mixed
The mixed type, representing any type.
Fields
Never
The never type, representing a type that never occurs (e.g., functions that always throw exceptions or exit).
GenericParameter
A generic parameter type, representing a type parameter with constraints.