final |
|---|
Result of a Type::accepts() check — whether one type accepts another. Wraps a TrinaryLogic result together with human-readable reasons explaining
why the acceptance failed. These reasons are surfaced in PHPStan error messages
to help developers understand type mismatches. For example, when checking if int accepts string, the result would be No
with a reason like "string is not a subtype of int". The accepts() method is used to check assignability — whether a value of one
type can be assigned to a variable/parameter of another type. This is stricter
than isSuperTypeOf() because it accounts for PHPStan's rule level and
generics variance.
| Methods | ||
|---|---|---|
public
|
__construct(TrinaryLogic $result, list<string> $reasons)
|
# |
public
|
yes(): bool
|
# |
public
|
maybe(): bool
|
# |
public
|
no(): bool
|
# |
public
static
|
createYes(): self
|
# |
public
static
|
createNo(list<string> $reasons = []): self
|
# |
public
static
|
createMaybe(): self
|
# |
public
static
|
createFromBoolean(bool $value): self
|
# |
public
|
and(self $other): self
|
# |
public
|
or(self $other): self
|
# |
public
|
decorateReasons(callable(string): string $cb): self
|
# |
public
static
|
extremeIdentity(self ...$operands): self
|
# |
public
static
|
maxMin(self ...$operands): self
|
# |