diff --git a/src/Result.php b/src/Result.php index 8aa24d0..a9a0d83 100644 --- a/src/Result.php +++ b/src/Result.php @@ -16,6 +16,7 @@ interface Result * 結果が成功(Ok)の場合に true を返します. * * @phpstan-assert-if-true Ok $this + * @phpstan-assert-if-false Err $this * * @return bool */ @@ -34,6 +35,7 @@ public function isOkAnd(callable $fn): bool; * 結果が失敗(Err)の場合に true を返します. * * @phpstan-assert-if-true Err $this + * @phpstan-assert-if-false Ok $this * * @return bool */ @@ -51,14 +53,14 @@ public function isErrAnd(callable $fn): bool; /** * 成功値を返します。失敗の場合は例外を投げます. * - * @return T + * @return ($this is Ok ? T : never) */ public function unwrap(): mixed; /** * エラー値を返します。成功の場合は例外を投げます. * - * @return E + * @return ($this is Err ? E : never) */ public function unwrapErr(): mixed; @@ -67,7 +69,7 @@ public function unwrapErr(): mixed; * * @template U * @param U $default - * @return T|U + * @return ($this is Ok ? T : U) */ public function unwrapOr(mixed $default): mixed;