diff --git a/src/EntityFinally.php b/src/EntityFinally.php index b8e5c4a..778d75c 100644 --- a/src/EntityFinally.php +++ b/src/EntityFinally.php @@ -8,5 +8,8 @@ interface EntityFinally { - public function handle(TaskStateInterface $state): void; + /** + * @param non-empty-string $uuid Task UUID + */ + public function handle(string $uuid, TaskStateInterface $state): void; } diff --git a/src/handler/TaskFinallyHandler.php b/src/handler/TaskFinallyHandler.php index a9aa429..b8f8c28 100644 --- a/src/handler/TaskFinallyHandler.php +++ b/src/handler/TaskFinallyHandler.php @@ -22,14 +22,17 @@ public function __construct(private readonly ContainerInterface $container) { } - public function handle(TaskOptions $options, TaskStateInterface $state): void + /** + * @param non-empty-string $uuid Task UUID + */ + public function handle(string $uuid, TaskOptions $options, TaskStateInterface $state): void { if ($options->finally === null) { return; } try { - $this->factory($options->finally)->handle($state); + $this->factory($options->finally)->handle($uuid, $state); } catch (Throwable) { } } diff --git a/src/processing/TaskHandler.php b/src/processing/TaskHandler.php index a4551ae..f08af2e 100644 --- a/src/processing/TaskHandler.php +++ b/src/processing/TaskHandler.php @@ -109,7 +109,12 @@ public function complete(string $taskUuid, string $stageUuid): TaskStateInterfac return $stateRelation; } - $this->finallyHandler->handle($task->getOptions(), $state); + $this->finallyHandler->handle( + $task->getUuid(), + $task->getOptions(), + $state, + ); + return $state; }