sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

[Bug] param type hints in signal method

Open eriklotin opened this issue 3 years ago • 0 comments

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
 }

eriklotin avatar Jun 22 '22 08:06 eriklotin