Skip to content

Commit d235876

Browse files
committed
feat: add tappable trait
1 parent 132c297 commit d235876

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Hypervel\Support\Traits;
6+
7+
use function Hyperf\Tappable\tap;
8+
9+
trait Tappable
10+
{
11+
/**
12+
* Call the given Closure with this instance then return the instance.
13+
*
14+
* @param null|(callable($this): mixed) $callback
15+
* @param null|mixed $callback
16+
* @return ($callback is null ? \Hyperf\Tappable\HigherOrderTapProxy : $this)
17+
*/
18+
public function tap($callback = null)
19+
{
20+
return tap($this, $callback);
21+
}
22+
}

0 commit comments

Comments
 (0)