mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 08:17:22 +01:00
fix: usage of named arguments
This commit is contained in:
@ -17,13 +17,13 @@ final class ChainableClosure
|
||||
*/
|
||||
public static function boundWhen(Closure $condition, Closure $next): Closure
|
||||
{
|
||||
return function () use ($condition, $next): void {
|
||||
return function (...$arguments) use ($condition, $next): void {
|
||||
if (! is_object($this)) { // @phpstan-ignore-line
|
||||
throw ShouldNotHappen::fromMessage('$this not bound to chainable closure.');
|
||||
}
|
||||
|
||||
if (\Pest\Support\Closure::bind($condition, $this, self::class)(...func_get_args())) {
|
||||
\Pest\Support\Closure::bind($next, $this, self::class)(...func_get_args());
|
||||
if (\Pest\Support\Closure::bind($condition, $this, self::class)(...$arguments)) {
|
||||
\Pest\Support\Closure::bind($next, $this, self::class)(...$arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -33,13 +33,13 @@ final class ChainableClosure
|
||||
*/
|
||||
public static function bound(Closure $closure, Closure $next): Closure
|
||||
{
|
||||
return function () use ($closure, $next): void {
|
||||
return function (...$arguments) use ($closure, $next): void {
|
||||
if (! is_object($this)) { // @phpstan-ignore-line
|
||||
throw ShouldNotHappen::fromMessage('$this not bound to chainable closure.');
|
||||
}
|
||||
|
||||
\Pest\Support\Closure::bind($closure, $this, self::class)(...func_get_args());
|
||||
\Pest\Support\Closure::bind($next, $this, self::class)(...func_get_args());
|
||||
\Pest\Support\Closure::bind($closure, $this, self::class)(...$arguments);
|
||||
\Pest\Support\Closure::bind($next, $this, self::class)(...$arguments);
|
||||
};
|
||||
}
|
||||
|
||||
@ -48,9 +48,9 @@ final class ChainableClosure
|
||||
*/
|
||||
public static function unbound(Closure $closure, Closure $next): Closure
|
||||
{
|
||||
return function () use ($closure, $next): void {
|
||||
$closure(...func_get_args());
|
||||
$next(...func_get_args());
|
||||
return function (...$arguments) use ($closure, $next): void {
|
||||
$closure(...$arguments);
|
||||
$next(...$arguments);
|
||||
};
|
||||
}
|
||||
|
||||
@ -59,9 +59,9 @@ final class ChainableClosure
|
||||
*/
|
||||
public static function boundStatically(Closure $closure, Closure $next): Closure
|
||||
{
|
||||
return static function () use ($closure, $next): void {
|
||||
\Pest\Support\Closure::bind($closure, null, self::class)(...func_get_args());
|
||||
\Pest\Support\Closure::bind($next, null, self::class)(...func_get_args());
|
||||
return static function (...$arguments) use ($closure, $next): void {
|
||||
\Pest\Support\Closure::bind($closure, null, self::class)(...$arguments);
|
||||
\Pest\Support\Closure::bind($next, null, self::class)(...$arguments);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user