| Methods |
public
|
__construct(list<Type> $types, bool $normalized = false)
|
#
|
public
|
filterTypes(callable $filterCb): Type
|
#
|
public
|
describe(VerbosityLevel $level): string
|
#
|
protected
|
unionTypes(callable $getType): Type
|
#
|
protected
|
pickFromTypes(callable $getValues, callable $criteria): array
|
#
|
public
|
getOffsetValueType(Type $offsetType): Type
|
#
|
protected
|
unionResults(callable $getResult): TrinaryLogic
|
#
|
public
|
isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Answers "is this compound type accepted by $acceptingType?" from the compound type's perspective. Called by simple types when they encounter a CompoundType argument in their accepts() method.
The compound type decomposes itself and calls $acceptingType->accepts() for each component. For example, UnionType(string|int)::isAcceptedBy(StringType) asks StringType to accept
string and int separately, then combines results with extremeIdentity (all must pass).
Answers "is this compound type accepted by $acceptingType?" from the compound type's perspective. Called by simple types when they encounter a CompoundType argument in their accepts() method.
The compound type decomposes itself and calls $acceptingType->accepts() for each component. For example, UnionType(string|int)::isAcceptedBy(StringType) asks StringType to accept
string and int separately, then combines results with extremeIdentity (all must pass).
Overrides
|
#
|
public
|
inferTemplateTypes(Type $receivedType): TemplateTypeMap
Infers the real types of TemplateTypes found in $this, based on
the received Type. E.g. if $this is array<T> and $receivedType
is array, infers T = int.
Infers the real types of TemplateTypes found in $this, based on
the received Type. E.g. if $this is array<T> and $receivedType
is array, infers T = int.
Overrides
|
#
|
public
|
inferTemplateTypesOn(Type $templateType): TemplateTypeMap
|
#
|
public
|
traverse(callable $cb): Type
Returns a new instance with all inner types mapped through $cb.
Returns the same instance if inner types did not change. Not used directly — use TypeTraverser::map() instead.
Returns a new instance with all inner types mapped through $cb.
Returns the same instance if inner types did not change. Not used directly — use TypeTraverser::map() instead.
Overrides
|
#
|
public
|
traverseSimultaneously(Type $right, callable $cb): Type
Like traverse(), but walks two types simultaneously. Not used directly — use SimultaneousTypeTraverser::map() instead.
Like traverse(), but walks two types simultaneously. Not used directly — use SimultaneousTypeTraverser::map() instead.
Overrides
|
#
|