| Methods |
public
static
|
clearCache(): void
Memoization hands back shared Type instances, and a Type lazily resolves a
ClassReflection belonging to the container that created it — so the cache must
not outlive its container.
Memoization hands back shared Type instances, and a Type lazily resolves a
ClassReflection belonging to the container that created it — so the cache must
not outlive its container.
|
#
|
public
static
|
addNull(Type $type): Type
|
#
|
public
static
|
remove(Type $fromType, Type $typeToRemove): Type
|
#
|
public
static
|
removeNull(Type $type): Type
|
#
|
public
static
|
containsNull(Type $type): bool
|
#
|
public
static
|
widen(Type $type): Type
The type, generalized where it holds more constant array values than
ConstantArrayTypeBuilder::ARRAY_COUNT_LIMIT or more shapes than
ArrayWidening::UNION_SHAPES_LIMIT: shapes with the same keys
merged, shapes sharing a required key folded into one, and what is still
too big degraded to an oversized array.
The type, generalized where it holds more constant array values than
ConstantArrayTypeBuilder::ARRAY_COUNT_LIMIT or more shapes than
ArrayWidening::UNION_SHAPES_LIMIT: shapes with the same keys
merged, shapes sharing a required key folded into one, and what is still
too big degraded to an oversized array.
union() is exact and never does this. Call it where the analysis joins
values that can grow without bound, such as the types of a variable after
branches, so a join stays small enough to compute with.
|
#
|
public
static
|
union(Type ...$types): Type
|
#
|
public
static
|
joinValues(Type ...$types): Type
The union of the values that different paths produce, as of the branches
of a ternary or the scopes merged after an if. Unlike union(), a mixed
result keeps the members it absorbed as its witness type: a path is known
to produce them. Narrowing must not call this, as its unions are not paths.
The union of the values that different paths produce, as of the branches
of a ternary or the scopes merged after an if. Unlike union(), a mixed
result keeps the members it absorbed as its witness type: a path is known
to produce them. Narrowing must not call this, as its unions are not paths.
|
#
|
public
static
|
joinNarrowedValues(list<Type> $types, list<Type|null> $narrowedFromTypes): Type
joinValues() of values that a narrowing may have refined from another
value, given at the same key in $narrowedFromTypes. A value narrowed from
mixed is not one a path produces: it brings to the witness type only the
part of that mixed's own witness it still allows.
joinValues() of values that a narrowing may have refined from another
value, given at the same key in $narrowedFromTypes. A value narrowed from
mixed is not one a path produces: it brings to the witness type only the
part of that mixed's own witness it still allows.
|
#
|
public
static
|
countConstantArrayValueTypes(Type[] $types): int
|
#
|
public
static
|
intersect(Type ...$types): Type
|
#
|
public
static
|
removeFalsey(Type $type): Type
|
#
|
public
static
|
removeTruthy(Type $type): Type
|
#
|