Skip to content

Commit 0cd5fe6

Browse files
committed
Cleanup
1 parent 960fcbb commit 0cd5fe6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/Internal/Transport/DetachedClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @internal Client is an internal library class, please do not use it in your code.
2323
* @psalm-internal Temporal\Internal\Transport
2424
*/
25-
final class DetachedClient implements ClientInterface, Destroyable
25+
final class DetachedClient implements ClientInterface
2626
{
2727
/** @var list<int> */
2828
private array $requests = [];

tests/Functional/WorkflowTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,6 @@ public function setUp(): void
436436
*/
437437
private static function getPrivate(object $object, string $key): mixed
438438
{
439-
return (static fn(object $value) => $value->{$key} ?? null)->call($object, $object);
439+
return (static fn(object $value) => $value->{$key} ?? null)->bindTo(null, $object)($object);
440440
}
441441
}

tests/Unit/Framework/ClientMock.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Temporal\Exception\Failure\CanceledFailure;
1010
use Temporal\Internal\Queue\QueueInterface;
1111
use Temporal\Internal\Transport\ClientInterface;
12+
use Temporal\Internal\Transport\DetachedClient;
1213
use Temporal\Internal\Transport\Request\UndefinedResponse;
1314
use Temporal\Worker\Transport\Command\CommandInterface;
1415
use Temporal\Worker\Transport\Command\FailureResponseInterface;
@@ -25,7 +26,6 @@ final class ClientMock implements ClientInterface
2526
private const ERROR_REQUEST_ID_DUPLICATION =
2627
'Unable to create a new request because a ' .
2728
'request with id %d has already been sent';
28-
2929
private const ERROR_REQUEST_NOT_FOUND =
3030
'Unable to receive a request with id %d because ' .
3131
'a request with that identifier was not sent';
@@ -104,9 +104,13 @@ public function reject(CommandInterface $command, \Throwable $reason): void
104104
$request->reject($reason);
105105
}
106106

107-
public function fork(): self
107+
public function fork(): ClientInterface
108108
{
109-
return $this;
109+
return new DetachedClient($this, function (array $ids): void {
110+
foreach ($ids as $id) {
111+
unset($this->requests[$id]);
112+
}
113+
});
110114
}
111115

112116
public function destroy(): void {}

0 commit comments

Comments
 (0)