You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param Type|null $witnessType Set when the accepted type is a mixed accepted on its own, but its witness type, what some path is known to produce, is not. Rules report it as the given type.
*/
public function __construct(
public readonly bool $result,
public readonly array $reasons,
public readonly ?Type $witnessType = null,
)
{
}
public function and(self $other): self
{
return new self(
$this->result && $other->result,
array_merge($this->reasons, $other->reasons),
$this->witnessType ?? $other->witnessType,
);
}
/**
* @param callable(string): string $cb
*/
public function decorateReasons(callable $cb): self
{
$reasons = [];
foreach ($this->reasons as $reason) {
$reasons[] = $cb($reason);
}
return new self($this->result, $reasons, $this->witnessType);