Skip to content

Commit ae63423

Browse files
committed
feat: improve return type for result message and enum string function
1 parent 49f6382 commit ae63423

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Contracts/Toolkit/Result/Result.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public function errors(): IListOfErrors;
6363
/**
6464
* Get the first error message, if there is one.
6565
*
66-
* @param (Closure(UnitEnum): string)|string|null $default the default value to use if there is no error message.
66+
* @param (Closure(UnitEnum): non-empty-string)|non-empty-string|null $default the default value to use if there is no error message.
67+
* @return ($default is Closure|string ? non-empty-string : null)
6768
*/
6869
public function error(Closure|string|null $default = null): ?string;
6970

src/Toolkit/functions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ function enum_value(int|string|UnitEnum $value): int|string
3232
if (!function_exists(__NAMESPACE__ . '\enum_string')) {
3333
/**
3434
* Return a string value for an enum.
35+
*
36+
* @return ($value is non-empty-string|UnitEnum ? non-empty-string : string)
3537
*/
3638
function enum_string(string|UnitEnum $value): string
3739
{

0 commit comments

Comments
 (0)