Skip to content

Commit e37b94e

Browse files
committed
feat: add throwIfReturn
1 parent a467853 commit e37b94e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Traits/Thrower.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,23 @@ public static function throw(...$arguments): void
2626
* @param mixed $value
2727
* @param mixed ...$arguments
2828
*/
29-
public static function throwIf($value, ...$arguments): void
29+
public static function throwIf(mixed $value, ...$arguments): void
3030
{
3131
if ($value) {
3232
static::throw(...$arguments);
3333
}
3434
}
35+
36+
/**
37+
* @param mixed $value
38+
* @param mixed ...$arguments
39+
*
40+
* @return bool
41+
*/
42+
public static function throwIfReturn(mixed $value, ...$arguments): bool
43+
{
44+
static::throwIf($value, ...$arguments);
45+
46+
return true;
47+
}
3548
}

0 commit comments

Comments
 (0)