Methods |
public
|
__construct(
list<ParameterReflection>|null $parameters = null,
?Type $returnType = null,
bool $variadic = true,
?TemplateTypeMap $templateTypeMap = null,
?TemplateTypeMap $resolvedTemplateTypeMap = null,
?TemplateTypeVarianceMap $callSiteVarianceMap = null,
array<non-empty-string, TemplateTag> $templateTags = [],
SimpleThrowPoint[] $throwPoints = [],
?SimpleImpurePoint[] $impurePoints = null,
InvalidateExprNode[] $invalidateExpressions = [],
string[] $usedVariables = [],
?TrinaryLogic $acceptsNamedArguments = null,
)
|
#
|
public
|
getTemplateTags(): array<non-empty-string, TemplateTag>
|
#
|
public
static
|
createPure(): self
|
#
|
public
|
isPure(): TrinaryLogic
|
#
|
public
|
getClassName(): string
|
#
|
public
|
getClassReflection(): ?ClassReflection
|
#
|
public
|
getAncestorWithClassName(string $className): ?TypeWithClassName
|
#
|
public
|
getReferencedClasses(): array
|
#
|
public
|
getObjectClassNames(): array
|
#
|
public
|
getObjectClassReflections(): array
|
#
|
public
|
accepts(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.
Implements
|
#
|
public
|
isSuperTypeOf(Type $type): IsSuperTypeOfResult
|
#
|
public
|
equals(Type $type): bool
|
#
|
public
|
describe(VerbosityLevel $level): string
|
#
|
public
|
isOffsetAccessLegal(): TrinaryLogic
|
#
|
public
|
isObject(): TrinaryLogic
|
#
|
public
|
isEnum(): TrinaryLogic
|
#
|
public
|
getTemplateType(string $ancestorClassName, string $templateTypeName): Type
Returns actual template type for a given object.
Returns actual template type for a given object.
Example:
@-template T
class Foo {}
// $fooType is Foo
$t = $fooType->getTemplateType(Foo::class, 'T');
$t->isInteger(); // yes
Returns ErrorType in case of a missing type.
Implements
|
#
|
public
|
canAccessProperties(): TrinaryLogic
|
#
|
public
|
hasProperty(string $propertyName): TrinaryLogic
|
#
|
public
|
getProperty(string $propertyName, ClassMemberAccessAnswerer $scope): ExtendedPropertyReflection
|
#
|
public
|
getUnresolvedPropertyPrototype(
string $propertyName,
ClassMemberAccessAnswerer $scope,
): UnresolvedPropertyPrototypeReflection
|
#
|
public
|
canCallMethods(): TrinaryLogic
|
#
|
public
|
hasMethod(string $methodName): TrinaryLogic
|
#
|
public
|
getMethod(string $methodName, ClassMemberAccessAnswerer $scope): ExtendedMethodReflection
|
#
|
public
|
getUnresolvedMethodPrototype(string $methodName, ClassMemberAccessAnswerer $scope): UnresolvedMethodPrototypeReflection
|
#
|
public
|
canAccessConstants(): TrinaryLogic
|
#
|
public
|
hasConstant(string $constantName): TrinaryLogic
|
#
|
public
|
getConstant(string $constantName): ClassConstantReflection
|
#
|
public
|
getConstantStrings(): array
|
#
|
public
|
isIterable(): TrinaryLogic
|
#
|
public
|
isIterableAtLeastOnce(): TrinaryLogic
|
#
|
public
|
isCallable(): TrinaryLogic
|
#
|
public
|
getEnumCases(): array
|
#
|
public
|
isCommonCallable(): bool
|
#
|
public
|
getCallableParametersAcceptors(ClassMemberAccessAnswerer $scope): array
|
#
|
public
|
getThrowPoints(): array
|
#
|
public
|
getImpurePoints(): array
|
#
|
public
|
getInvalidateExpressions(): array
|
#
|
public
|
getUsedVariables(): array
|
#
|
public
|
acceptsNamedArguments(): TrinaryLogic
|
#
|
public
|
isCloneable(): TrinaryLogic
|
#
|
public
|
toBoolean(): BooleanType
|
#
|
public
|
toNumber(): Type
|
#
|
public
|
toAbsoluteNumber(): Type
|
#
|
public
|
toInteger(): Type
|
#
|
public
|
toFloat(): Type
|
#
|
public
|
toString(): Type
|
#
|
public
|
toArray(): Type
|
#
|
public
|
toArrayKey(): Type
|
#
|
public
|
getTemplateTypeMap(): TemplateTypeMap
|
#
|
public
|
getResolvedTemplateTypeMap(): TemplateTypeMap
|
#
|
public
|
getCallSiteVarianceMap(): TemplateTypeVarianceMap
|
#
|
public
|
getParameters(): list<ParameterReflection>
|
#
|
public
|
isVariadic(): bool
|
#
|
public
|
getReturnType(): Type
|
#
|
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.
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.
|
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.
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.
Implements
|
#
|
public
|
isNull(): TrinaryLogic
|
#
|
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.
Implements
|
#
|
public
|
isConstantScalarValue(): TrinaryLogic
Is Type of a known constant scalar value? Includes literal strings, integers, floats, true, false, and null.
Is Type of a known constant scalar value? Includes literal strings, integers, floats, true, false, and null.
Implements
|
#
|
public
|
getConstantScalarTypes(): array
|
#
|
public
|
getConstantScalarValues(): array
|
#
|
public
|
isTrue(): TrinaryLogic
|
#
|
public
|
isFalse(): TrinaryLogic
|
#
|
public
|
isBoolean(): TrinaryLogic
|
#
|
public
|
isFloat(): TrinaryLogic
|
#
|
public
|
isInteger(): TrinaryLogic
|
#
|
public
|
isString(): TrinaryLogic
|
#
|
public
|
isNumericString(): TrinaryLogic
|
#
|
public
|
isNonEmptyString(): TrinaryLogic
|
#
|
public
|
isNonFalsyString(): TrinaryLogic
|
#
|
public
|
isLiteralString(): TrinaryLogic
|
#
|
public
|
isLowercaseString(): TrinaryLogic
|
#
|
public
|
isClassString(): TrinaryLogic
|
#
|
public
|
getClassStringObjectType(): Type
Returns object type Foo for class-string<Foo> and 'Foo' (if Foo is a valid class).
Returns object type Foo for class-string<Foo> and 'Foo' (if Foo is a valid class).
Implements
|
#
|
public
|
getObjectTypeOrClassStringObjectType(): Type
Returns object type Foo for class-string<Foo>, 'Foo' (if Foo is a valid class),
and object type Foo.
Returns object type Foo for class-string<Foo>, 'Foo' (if Foo is a valid class),
and object type Foo.
Implements
|
#
|
public
|
isVoid(): TrinaryLogic
|
#
|
public
|
isScalar(): TrinaryLogic
|
#
|
public
|
looseCompare(Type $type, PhpVersion $phpVersion): BooleanType
|
#
|
public
|
exponentiate(Type $exponent): Type
|
#
|
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.
Implements
|
#
|
public
|
toPhpDocNode(): TypeNode
|
#
|