Methods |
public
|
__construct(
array<int, ConstantIntegerType|ConstantStringType> $keyTypes,
array<int, Type> $valueTypes,
non-empty-list<int>|int $nextAutoIndexes = [0],
int[] $optionalKeys = [],
bool|TrinaryLogic $isList = false,
)
|
#
|
public
|
getConstantArrays(): array
|
#
|
public
|
isConstantValue(): TrinaryLogic
Is Type of a known constant value? Includes literal strings, integers, floats, true, false, null, and array shapes.
Is Type of a known constant value? Includes literal strings, integers, floats, true, false, null, and array shapes.
Overrides
Implements
|
#
|
public
|
isEmpty(): bool
Deprecated
Use isIterableAtLeastOnce()->no() instead
|
#
|
public
|
getNextAutoIndexes(): non-empty-list<int>
|
#
|
public
|
getNextAutoIndex(): int
|
#
|
public
|
getOptionalKeys(): int[]
|
#
|
public
|
getAllArrays(): self[]
|
#
|
public
|
getKeyTypes(): array<int, ConstantIntegerType|ConstantStringType>
|
#
|
public
|
getFirstKeyType(): Type
Deprecated
Use getFirstIterableKeyType() instead
|
#
|
public
|
getLastKeyType(): Type
Deprecated
Use getLastIterableKeyType() instead
|
#
|
public
|
getValueTypes(): array<int, Type>
|
#
|
public
|
getFirstValueType(): Type
Deprecated
Use getFirstIterableValueType() instead
|
#
|
public
|
getLastValueType(): Type
Deprecated
Use getLastIterableValueType() instead
|
#
|
public
|
isOptionalKey(int $i): bool
|
#
|
public
|
accepts(Type $type, bool $strictTypes): TrinaryLogic
|
#
|
public
|
acceptsWithReason(Type $type, bool $strictTypes): AcceptsResult
This is like accepts() but gives reasons
why the type was not/might not be accepted in some non-intuitive scenarios.
This is like accepts() but gives reasons
why the type was not/might not be accepted in some non-intuitive scenarios.
In PHPStan 2.0 this method will be removed and the return type of accepts()
will change to AcceptsResult.
Overrides
Implements
|
#
|
public
|
isSuperTypeOf(Type $type): TrinaryLogic
|
#
|
public
|
looseCompare(Type $type, PhpVersion $phpVersion): BooleanType
|
#
|
public
|
equals(Type $type): bool
|
#
|
public
|
isCallable(): TrinaryLogic
|
#
|
public
|
getCallableParametersAcceptors(ClassMemberAccessAnswerer $scope): array
|
#
|
public
|
findTypeAndMethodName(): ?ConstantArrayTypeAndMethod
Deprecated
Use findTypeAndMethodNames() instead
|
#
|
public
|
findTypeAndMethodNames(): ConstantArrayTypeAndMethod[]
|
#
|
public
|
hasOffsetValueType(Type $offsetType): TrinaryLogic
|
#
|
public
|
getOffsetValueType(Type $offsetType): Type
|
#
|
public
|
setOffsetValueType(?Type $offsetType, Type $valueType, bool $unionValues = true): Type
|
#
|
public
|
setExistingOffsetValueType(Type $offsetType, Type $valueType): Type
|
#
|
public
|
unsetOffset(Type $offsetType): Type
|
#
|
public
|
fillKeysArray(Type $valueType): Type
|
#
|
public
|
flipArray(): Type
|
#
|
public
|
intersectKeyArray(Type $otherArraysType): Type
|
#
|
public
|
popArray(): Type
|
#
|
public
|
searchArray(Type $needleType): Type
|
#
|
public
|
shiftArray(): Type
|
#
|
public
|
shuffleArray(): Type
|
#
|
public
|
isIterableAtLeastOnce(): TrinaryLogic
|
#
|
public
|
getArraySize(): Type
|
#
|
public
|
getFirstIterableKeyType(): Type
|
#
|
public
|
getLastIterableKeyType(): Type
|
#
|
public
|
getFirstIterableValueType(): Type
|
#
|
public
|
getLastIterableValueType(): Type
|
#
|
public
|
isConstantArray(): TrinaryLogic
|
#
|
public
|
isList(): TrinaryLogic
|
#
|
public
|
removeLast(): self
|
#
|
public
|
removeFirst(): self
|
#
|
public
|
slice(int $offset, ?int $limit, bool $preserveKeys = false): self
|
#
|
public
|
reverse(bool $preserveKeys = false): self
|
#
|
public
|
chunk(positive-int $length, bool $preserveKeys = false): self
|
#
|
public
|
toBoolean(): BooleanType
|
#
|
public
|
toInteger(): Type
|
#
|
public
|
toFloat(): Type
|
#
|
public
|
generalize(GeneralizePrecision $precision): Type
|
#
|
public
|
generalizeValues(): self
|
#
|
public
|
generalizeToArray(): Type
|
#
|
public
|
getKeysArray(): self
|
#
|
public
|
getValuesArray(): self
|
#
|
public
|
count(): Type
Deprecated
Use getArraySize() instead
Overrides
|
#
|
public
|
describe(VerbosityLevel $level): string
|
#
|
public
|
inferTemplateTypes(Type $receivedType): TemplateTypeMap
Infers template types
Infers template types
Infers the real Type of the TemplateTypes found in $this, based on
the received Type.
Overrides
Implements
|
#
|
public
|
getReferencedTemplateTypes(TemplateTypeVariance $positionVariance): array
Returns the template types referenced by this Type, recursively
Returns the template types referenced by this Type, recursively
The return value is a list of TemplateTypeReferences, who contain the
referenced template type as well as the variance position in which it was
found.
For example, calling this on array<Foo<T>,Bar> (with T a template type)
will return one TemplateTypeReference for the type T.
Parameters
$positionVariance |
The variance position in
which the receiver type was
found.
|
Overrides
Implements
|
#
|
public
|
traverse(callable $cb): Type
Traverses inner types
Traverses inner types
Returns a new instance with all inner types mapped through $cb. Might
return the same instance if inner types did not change.
Overrides
Implements
|
#
|
public
|
traverseSimultaneously(Type $right, callable $cb): Type
Traverses inner types while keeping the same context in another type.
Traverses inner types while keeping the same context in another type.
Overrides
Implements
|
#
|
public
|
isKeysSupersetOf(self $otherArray): bool
|
#
|
public
|
mergeWith(self $otherArray): self
|
#
|
public
|
makeOffsetRequired(Type $offsetType): self
|
#
|
public
|
toPhpDocNode(): TypeNode
|
#
|
public
static
|
isValidIdentifier(string $value): bool
|
#
|
public
|
getFiniteTypes(): array
Returns a list of finite values.
Returns a list of finite values.
Examples:
- for bool: [true, false]
- for int<0, 3>: [0, 1, 2, 3]
- for enums: list of enum cases
- for scalars: the scalar itself
For infinite types it returns an empty array.
Overrides
Implements
|
#
|
public
static
|
__set_state(mixed[] $properties): Type
|
#
|