1111
1212namespace Temporal \Internal \Declaration ;
1313
14+ use React \Promise \PromiseInterface ;
1415use Temporal \DataConverter \ValuesInterface ;
1516use Temporal \Interceptor \WorkflowInbound \QueryInput ;
1617use Temporal \Interceptor \WorkflowInbound \UpdateInput ;
1718use Temporal \Interceptor \WorkflowInboundCallsInterceptor ;
1819use Temporal \Internal \Declaration \Prototype \WorkflowPrototype ;
1920use Temporal \Internal \Declaration \WorkflowInstance \SignalQueue ;
20- use Temporal \Internal \Declaration \WorkflowInstance \UpdateQueue ;
2121use Temporal \Internal \Interceptor ;
2222
2323/**
2424 * @psalm-import-type DispatchableHandler from InstanceInterface
2525 * @psalm-type QueryHandler = \Closure(QueryInput): mixed
26- * @psalm-type UpdateHandler = \Closure(UpdateInput): mixed
26+ * @psalm-type UpdateHandler = \Closure(UpdateInput): PromiseInterface
2727 * @psalm-type ValidateUpdateHandler = \Closure(UpdateInput): void
2828 * @psalm-type QueryExecutor = \Closure(QueryInput, callable(ValuesInterface): mixed): mixed
29- * @psalm-type UpdateExecutor = \Closure(UpdateInput, callable(ValuesInterface): mixed): mixed
29+ * @psalm-type UpdateExecutor = \Closure(UpdateInput, callable(ValuesInterface): mixed): PromiseInterface
3030 * @psalm-type ValidateUpdateExecutor = \Closure(UpdateInput, callable(ValuesInterface): mixed): mixed
3131 * @psalm-type UpdateValidator = \Closure(UpdateInput, UpdateHandler): void
3232 */
@@ -65,7 +65,7 @@ final class WorkflowInstance extends Instance implements WorkflowInstanceInterfa
6565
6666 /**
6767 * @param WorkflowPrototype $prototype
68- * @param object $context
68+ * @param object $context Workflow object
6969 * @param Interceptor\Pipeline<WorkflowInboundCallsInterceptor, mixed> $pipeline
7070 */
7171 public function __construct (
@@ -141,7 +141,7 @@ public function setUpdateValidator(\Closure $validator): self
141141 */
142142 public function initConstructor (): void
143143 {
144- if (method_exists ($ this ->context , '__construct ' )) {
144+ if (\ method_exists ($ this ->context , '__construct ' )) {
145145 $ this ->context ->__construct ();
146146 }
147147 }
@@ -156,8 +156,8 @@ public function getSignalQueue(): SignalQueue
156156
157157 /**
158158 * @param non-empty-string $name
159- * @return null|\Closure(ValuesInterface):mixed
160159 *
160+ * @return null|\Closure(QueryInput): mixed
161161 * @psalm-return QueryHandler|null
162162 */
163163 public function findQueryHandler (string $ name ): ?\Closure
@@ -166,8 +166,10 @@ public function findQueryHandler(string $name): ?\Closure
166166 }
167167
168168 /**
169- * @param string $name
170- * @return \Closure
169+ * @param non-empty-string $name
170+ *
171+ * @return null|\Closure(UpdateInput): PromiseInterface
172+ * @psalm-return UpdateHandler|null
171173 */
172174 public function findUpdateHandler (string $ name ): ?\Closure
173175 {
@@ -176,6 +178,9 @@ public function findUpdateHandler(string $name): ?\Closure
176178
177179 /**
178180 * @param non-empty-string $name
181+ *
182+ * @return null|\Closure(UpdateInput): void
183+ * @psalm-return ValidateUpdateHandler|null
179184 */
180185 public function findValidateUpdateHandler (string $ name ): ?\Closure
181186 {
@@ -234,10 +239,6 @@ public function getUpdateHandlerNames(): array
234239 return \array_keys ($ this ->updateHandlers );
235240 }
236241
237- /**
238- * @param string $name
239- * @return \Closure
240- */
241242 public function getSignalHandler (string $ name ): \Closure
242243 {
243244 return fn (ValuesInterface $ values ) => $ this ->signalQueue ->push ($ name , $ values );
0 commit comments