sdk-php
sdk-php copied to clipboard
[Bug] param type hints in signal method
Describe the bug
If you pass associative array as signal parameter, Temporal converts it to \stdClass. But you cannot set \stdClass as a param type in signal's method.
Minimal Reproduction
You call two signals:
$workflow = $workflowClient->newWorkflowStub(
MyWorkflow::class,
WorkflowOptions::new()->withTaskQueue('my-task-queue')
);
$run = $this->workflowClient->start($workflow);
$workflow->mySignal1(['foo' => 'bar']);
$workflow->mySignal2(['foo' => 'bar']);
MyWorkflow.php:
#[SignalMethod]
public function mySignal1(\stdClass $param): void
{
var_dump($param); // empty \stdClass
}
#[SignalMethod]
public function mySignal2($param): void
{
var_dump($param); // \stdClass with `foo` property
}