feat(describe): more refactor

This commit is contained in:
Nuno Maduro
2023-05-26 20:01:55 +01:00
parent 68ea2c7d7e
commit 551fa01415
7 changed files with 14 additions and 32 deletions

View File

@ -29,9 +29,9 @@ final class ChainableClosure
}
/**
* Calls the given `$closure` and chains the `$next` closure.
* Calls the given `$closure` and chains the `$next` closure, "bound" to the same object.
*/
public static function fromSameObject(Closure $closure, Closure $next): Closure
public static function bound(Closure $closure, Closure $next): Closure
{
return function () use ($closure, $next): void {
if (! is_object($this)) { // @phpstan-ignore-line
@ -44,9 +44,9 @@ final class ChainableClosure
}
/**
* Calls the given `$closure` and chains the `$next` closure.
* Calls the given `$closure` and chains the `$next` closure, "unbound" of any object.
*/
public static function fromDifferentObjects(Closure $closure, Closure $next): Closure
public static function unbound(Closure $closure, Closure $next): Closure
{
return function () use ($closure, $next): void {
$closure(...func_get_args());