| Methods |
public
static
|
createInvariant(): self
Type argument must match exactly. This is the default for @template T.
Type argument must match exactly. This is the default for @template T.
|
#
|
public
static
|
createCovariant(): self
Subtyping flows with the type argument: Cat <: Animal ⟹ Box<Cat> <: Box<Animal>.
Subtyping flows with the type argument: Cat <: Animal ⟹ Box<Cat> <: Box<Animal>.
|
#
|
public
static
|
createContravariant(): self
Subtyping flows against the type argument: Cat <: Animal ⟹ Box<Animal> <: Box<Cat>.
Subtyping flows against the type argument: Cat <: Animal ⟹ Box<Animal> <: Box<Cat>.
|
#
|
public
static
|
createStatic(): self
Special variance for static return type in template context.
Special variance for static return type in template context.
|
#
|
public
static
|
createBivariant(): self
Type argument is ignored for subtyping — all types are compatible.
Type argument is ignored for subtyping — all types are compatible.
|
#
|
public
|
invariant(): bool
|
#
|
public
|
covariant(): bool
|
#
|
public
|
contravariant(): bool
|
#
|
public
|
static(): bool
|
#
|
public
|
bivariant(): bool
|
#
|
public
|
compose(self $other): self
|
#
|
public
|
isValidVariance(TemplateType $templateType, Type $a, Type $b, bool $strict = false): IsSuperTypeOfResult
By default mixed and benevolent unions are compatible with any other type
argument in both directions - that is how gradual typing works. With $strict that answer is not given: it makes the relation symmetric
(Foo<mixed> and Foo<int> end up supertypes of each other) and
TypeCombinator::union() then discards one of them depending on the order the
types come in. In the strict mode invariance is relaxed just enough to keep
Foo<mixed> a supertype of Foo<int> and not the other way around.
By default mixed and benevolent unions are compatible with any other type
argument in both directions - that is how gradual typing works. With $strict that answer is not given: it makes the relation symmetric
(Foo<mixed> and Foo<int> end up supertypes of each other) and
TypeCombinator::union() then discards one of them depending on the order the
types come in. In the strict mode invariance is relaxed just enough to keep
Foo<mixed> a supertype of Foo<int> and not the other way around.
|
#
|
public
|
equals(self $other): bool
|
#
|
public
|
validPosition(self $other): bool
|
#
|
public
|
describe(): string
|
#
|
public
|
toPhpDocNodeVariance(): GenericTypeNode::VARIANCE_*
|
#
|