feat(describe): continues work around hooks

This commit is contained in:
Nuno Maduro
2023-05-26 19:29:46 +01:00
parent 465c65243d
commit 3e8616ec64
11 changed files with 132 additions and 172 deletions

View File

@ -31,7 +31,7 @@ final class ChainableClosure
/**
* Calls the given `$closure` and chains the `$next` closure.
*/
public static function from(Closure $closure, Closure $next): Closure
public static function fromSameObject(Closure $closure, Closure $next): Closure
{
return function () use ($closure, $next): void {
if (! is_object($this)) { // @phpstan-ignore-line
@ -43,6 +43,17 @@ final class ChainableClosure
};
}
/**
* Calls the given `$closure` and chains the `$next` closure.
*/
public static function fromDifferentObjects(Closure $closure, Closure $next): Closure
{
return function () use ($closure, $next): void {
$closure(...func_get_args());
$next(...func_get_args());
};
}
/**
* Call the given static `$closure` and chains the `$next` closure.
*/