diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 85478f9..0c15e8d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -94,7 +94,7 @@ jobs: run: "composer normalize --ansi --dry-run" - name: "Cache cache directory for easy-coding-standard/easy-coding-standard" - uses: "actions/cache@v4.0.2" + uses: "actions/cache@v4" with: path: ".build/ecs" key: "php-${{ matrix.php-version }}-ecs-${{ github.ref_name }}" diff --git a/src/Result.php b/src/Result.php index 47daae0..53728cf 100644 --- a/src/Result.php +++ b/src/Result.php @@ -61,7 +61,7 @@ abstract public function err(): Option; * * @template U * - * @param callable(T=):U $mapper + * @param callable(T):U $mapper * @return Result */ abstract public function map(callable $mapper): self; @@ -72,7 +72,7 @@ abstract public function map(callable $mapper): self; * @template U * * @param U $default - * @param callable(T=):U $f + * @param callable(T):U $f * * @return U */ @@ -83,8 +83,8 @@ abstract public function mapOr($default, callable $f): mixed; * * @template U * - * @param callable(E=):U $default - * @param callable(T=):U $f + * @param callable(E):U $default + * @param callable(T):U $f * * @return U */ @@ -95,7 +95,7 @@ abstract public function mapOrElse(callable $default, callable $f): mixed; * * @template F * - * @param callable(E=):F $op + * @param callable(E):F $op * @return Result */ abstract public function mapErr(callable $op): self; @@ -103,7 +103,7 @@ abstract public function mapErr(callable $op): self; /** * Calls a function with a reference to the contained value if Ok. * - * @param callable(T=):void $f + * @param callable(T):void $f * * @return Result */ @@ -112,7 +112,7 @@ abstract public function inspect(callable $f): self; /** * Calls a function with a reference to the contained value if Err. * - * @param callable(E=):void $f + * @param callable(E):void $f * * @return Result */ @@ -172,9 +172,10 @@ abstract public function and(self $res): self; * Calls op if the result is Ok, otherwise returns the Err value of self. * * @template U + * @template F * - * @param callable(T=):Result $op - * @return Result + * @param callable(T):Result $op + * @return Result */ abstract public function andThen(callable $op): self; @@ -191,26 +192,31 @@ abstract public function or(self $res): self; /** * Calls op if the result is Err, otherwise returns the Ok value of self. * + * @template U * @template F * - * @param callable(E=):Result $op - * @return Result + * @param callable(E):Result $op + * @return Result */ abstract public function orElse(callable $op): self; /** * Unwraps a result, yielding the content of an Ok. Else, it returns optb. * - * @param T $optb - * @return T + * @template U + * + * @param U $optb + * @return T|U */ abstract public function unwrapOr($optb): mixed; /** * Unwraps a result, yielding the content of an Ok. If the value is an Err then it calls op with its value. * - * @param callable(E=):T $op - * @return T + * @template U + * + * @param callable(E):U $op + * @return T|U */ abstract public function unwrapOrElse(callable $op): mixed; }