|
41 | 41 | use Temporal\Interceptor\WorkflowClient\StartInput; |
42 | 42 | use Temporal\Interceptor\WorkflowClient\UpdateInput; |
43 | 43 | use Temporal\Interceptor\WorkflowClient\UpdateWithStartInput; |
| 44 | +use Temporal\Interceptor\WorkflowClient\UpdateWithStartOutput; |
44 | 45 | use Temporal\Interceptor\WorkflowClientCallsInterceptor; |
45 | 46 | use Temporal\Internal\Interceptor\Pipeline; |
46 | 47 | use Temporal\Internal\Support\DateInterval; |
@@ -128,21 +129,19 @@ function (SignalWithStartInput $input): WorkflowExecution { |
128 | 129 |
|
129 | 130 | /** |
130 | 131 | * @param non-empty-string $workflowType |
131 | | - * |
132 | | - * @return array{WorkflowExecution, UpdateHandle|\Throwable} |
133 | 132 | */ |
134 | 133 | public function updateWithStart( |
135 | 134 | string $workflowType, |
136 | 135 | WorkflowOptions $options, |
137 | 136 | UpdateOptions $update, |
138 | 137 | array $updateArgs = [], |
139 | 138 | array $startArgs = [], |
140 | | - ): array { |
| 139 | + ): UpdateWithStartOutput { |
141 | 140 | $arguments = EncodedValues::fromValues($startArgs, $this->converter); |
142 | 141 | $updateArguments = EncodedValues::fromValues($updateArgs, $this->converter); |
143 | 142 |
|
144 | 143 | return $this->interceptors->with( |
145 | | - function (UpdateWithStartInput $input): array { |
| 144 | + function (UpdateWithStartInput $input): UpdateWithStartOutput { |
146 | 145 | $startRequest = $this->configureExecutionRequest( |
147 | 146 | new StartWorkflowExecutionRequest(), |
148 | 147 | $input->workflowStartInput, |
@@ -234,20 +233,23 @@ function (UpdateWithStartInput $input): array { |
234 | 233 | workflowExecution: $execution, |
235 | 234 | ); |
236 | 235 | } catch (\RuntimeException $e) { |
237 | | - return [$execution, $e]; |
| 236 | + return new UpdateWithStartOutput($execution, $e); |
238 | 237 | } |
239 | 238 |
|
240 | | - return [$execution, new UpdateHandle( |
241 | | - client: $this->serviceClient, |
242 | | - clientOptions: $this->clientOptions, |
243 | | - converter: $this->converter, |
244 | | - execution: $updateResult->getReference()->workflowExecution, |
245 | | - workflowType: $input->updateInput->workflowType, |
246 | | - updateName: $input->updateInput->updateName, |
247 | | - resultType: $input->updateInput->resultType, |
248 | | - updateId: $updateResult->getReference()->updateId, |
249 | | - result: $updateResult->getResult(), |
250 | | - )]; |
| 239 | + return new UpdateWithStartOutput( |
| 240 | + $execution, |
| 241 | + new UpdateHandle( |
| 242 | + client: $this->serviceClient, |
| 243 | + clientOptions: $this->clientOptions, |
| 244 | + converter: $this->converter, |
| 245 | + execution: $updateResult->getReference()->workflowExecution, |
| 246 | + workflowType: $input->updateInput->workflowType, |
| 247 | + updateName: $input->updateInput->updateName, |
| 248 | + resultType: $input->updateInput->resultType, |
| 249 | + updateId: $updateResult->getReference()->updateId, |
| 250 | + result: $updateResult->getResult(), |
| 251 | + ), |
| 252 | + ); |
251 | 253 | }, |
252 | 254 | /** @see WorkflowClientCallsInterceptor::updateWithStart() */ |
253 | 255 | 'updateWithStart', |
|
0 commit comments