Skip to content

Commit 2da9447

Browse files
authored
Clarify signals feature documentation and examples
Updated the documentation for the signals feature, clarifying the usage of the await() function and making minor adjustments to the code examples.
1 parent dfc5535 commit 2da9447

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

docs/features/signals.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ class MyWorkflow extends Workflow
2121
{
2222
$this->ready = $ready;
2323
}
24+
25+
public function execute()
26+
{
27+
// ...
28+
}
2429
}
2530
```
2631

@@ -34,15 +39,22 @@ $workflow = WorkflowStub::load($workflowId);
3439
$workflow->setReady(true);
3540
```
3641

37-
The `await()` helper function can be used in a workflow to pause execution until a specified condition is met. For example, to pause the workflow until a signal is received, the following code can be used:
42+
The `await()` function can be used in a workflow to pause execution until a specified condition is met. For example, to pause the workflow until a signal is received, the following code can be used:
3843

39-
```
44+
```php
4045
use function Workflow\await;
46+
use Workflow\SignalMethod;
4147
use Workflow\Workflow;
4248

4349
class MyWorkflow extends Workflow
4450
{
45-
private bool $ready = false;
51+
protected $ready = false;
52+
53+
#[SignalMethod]
54+
public function setReady($ready)
55+
{
56+
$this->ready = $ready;
57+
}
4658

4759
public function execute()
4860
{
@@ -51,4 +63,4 @@ class MyWorkflow extends Workflow
5163
}
5264
```
5365

54-
**Important:** The `await()` method should only be used in a workflow, and not in an activity.
66+
**Important:** The `await()` function should only be used in a workflow, not an activity.

0 commit comments

Comments
 (0)