mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
feat(describe): more refactor
This commit is contained in:
@ -28,7 +28,7 @@ final class AfterEachRepository
|
||||
if (array_key_exists($filename, $this->state)) {
|
||||
$fromAfterEachTestCase = $this->state[$filename];
|
||||
|
||||
$afterEachTestCase = ChainableClosure::fromSameObject($fromAfterEachTestCase, $afterEachTestCase)
|
||||
$afterEachTestCase = ChainableClosure::bound($fromAfterEachTestCase, $afterEachTestCase)
|
||||
->bindTo($afterEachCall, $afterEachCall::class);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ final class AfterEachRepository
|
||||
{
|
||||
$afterEach = $this->state[$filename] ?? NullClosure::create();
|
||||
|
||||
return ChainableClosure::fromSameObject(function (): void {
|
||||
return ChainableClosure::bound(function (): void {
|
||||
if (class_exists(Mockery::class)) {
|
||||
if ($container = Mockery::getContainer()) {
|
||||
/* @phpstan-ignore-next-line */
|
||||
|
||||
@ -27,8 +27,8 @@ final class BeforeEachRepository
|
||||
if (array_key_exists($filename, $this->state)) {
|
||||
[$fromBeforeEachTestCall, $fromBeforeEachTestCase] = $this->state[$filename];
|
||||
|
||||
$beforeEachTestCall = ChainableClosure::fromDifferentObjects($fromBeforeEachTestCall, $beforeEachTestCall);
|
||||
$beforeEachTestCase = ChainableClosure::fromSameObject($fromBeforeEachTestCase, $beforeEachTestCase)->bindTo($beforeEachCall, $beforeEachCall::class);
|
||||
$beforeEachTestCall = ChainableClosure::unbound($fromBeforeEachTestCall, $beforeEachTestCall);
|
||||
$beforeEachTestCase = ChainableClosure::bound($fromBeforeEachTestCase, $beforeEachTestCase)->bindTo($beforeEachCall, $beforeEachCall::class);
|
||||
}
|
||||
|
||||
assert($beforeEachTestCall instanceof Closure);
|
||||
|
||||
Reference in New Issue
Block a user