EagerLoadMapType
class EagerLoadMapType implements CompoundType, LateResolvableType
The expected type of a relation-keyed map, built per key from the map a call passes.
The method template takes the whole argument, as in eager-loads<TModel, TRelations> with
@template TRelations of array, so each constant key's callback expects that key's own relation or builder.
Upstream's stubs union the keys instead, which accepts a callback written for another key's relation.
Integer keys, keys that name no model and maps without constant keys keep Laravel's value type. Optional
keys stay optional, and a supplied callback's type never becomes part of the expected type.
Traits
Methods
Create an eager-load map type.
Build the expected map from the map's constant keys.
Infer the map template from the whole argument, so each key keeps its own value.
Determine whether the type can be resolved, which waits for its template types.
Get the classes the type refers to.
Get the template types the type refers to.
Determine whether the type equals another.
Describe the type.
Map the inner types.
Map the inner types together with another eager-load map type's.
Convert the type to a PHPDoc node.
Generalize the inner types.
Details
at line 63
__construct(EagerLoadMapKind $kind, Type|null $model, Type $map, BuilderHelper $builderHelper)
Create an eager-load map type.
at line 74
protected Type
getResult()
Build the expected map from the map's constant keys.
at line 317
TemplateTypeMap
inferTemplateTypes(Type $receivedType)
Infer the map template from the whole argument, so each key keeps its own value.
at line 325
bool
isResolvable()
Determine whether the type can be resolved, which waits for its template types.
at line 336
array
getReferencedClasses()
Get the classes the type refers to.
at line 346
array
getReferencedTemplateTypes(TemplateTypeVariance $positionVariance)
Get the template types the type refers to.
at line 359
bool
equals(Type $type)
Determine whether the type equals another.
at line 370
string
describe(VerbosityLevel $level)
Describe the type.
at line 382
Type
traverse(callable $cb)
Map the inner types.
at line 397
Type
traverseSimultaneously(Type $right, callable $cb)
Map the inner types together with another eager-load map type's.
at line 416
TypeNode
toPhpDocNode()
Convert the type to a PHPDoc node.
at line 427
Type
generalize(GeneralizePrecision $precision)
Generalize the inner types.