Skip to content

Commit b78b86d

Browse files
Remove v2 entry compatibility copy
Issue: zorporation/durable-workflow#531 Loop-ID: build-02
1 parent 245bb2a commit b78b86d

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ There's also a [sample application](https://github.com/durable-workflow/sample-a
2929

3030
**1. Create a workflow**
3131
```php
32-
use function Workflow\activity;
33-
use Workflow\Workflow;
32+
use function Workflow\V2\activity;
33+
use Workflow\V2\Workflow;
3434

3535
class MyWorkflow extends Workflow
3636
{
37-
public function execute($name)
37+
public function handle(string $name): string
3838
{
39-
$result = yield activity(MyActivity::class, $name);
39+
$result = activity(MyActivity::class, $name);
4040

4141
return $result;
4242
}
@@ -45,11 +45,11 @@ class MyWorkflow extends Workflow
4545

4646
**2. Create an activity**
4747
```php
48-
use Workflow\Activity;
48+
use Workflow\V2\Activity;
4949

5050
class MyActivity extends Activity
5151
{
52-
public function execute($name)
52+
public function handle(string $name): string
5353
{
5454
return "Hello, {$name}!";
5555
}
@@ -58,7 +58,7 @@ class MyActivity extends Activity
5858

5959
**3. Run the workflow**
6060
```php
61-
use Workflow\WorkflowStub;
61+
use Workflow\V2\WorkflowStub;
6262

6363
$workflow = WorkflowStub::make(MyWorkflow::class);
6464
$workflow->start('world');

docs/api-stability.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ major bump.
7373

7474
## `Workflow\V2\Workflow` authoring facade
7575

76-
The abstract base class `Workflow\V2\Workflow` is the canonical authoring
77-
API for v2 workflows. It exposes two surfaces, both covered by the
78-
semver guarantee:
76+
The abstract base class `Workflow\V2\Workflow` is the stable authoring API
77+
for v2 workflows. It exposes two surfaces, both covered by the semver
78+
guarantee:
7979

8080
- **Instance members** applications rely on inside a `handle()` method:
8181
`workflowId()`, `runId()`, `lastChild()`,

src/V2/Support/EntryMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private static function describe(object|string $target, string $baseClass, strin
8484

8585
if (is_string($executeDeclaredOn)) {
8686
throw new LogicException(sprintf(
87-
'V2 %s [%s] must use handle() as its only public entry method; execute() is not supported as a v2 entry method.',
87+
'V2 %s [%s] must declare a public handle() method; execute() is not supported as a v2 entry method.',
8888
$type,
8989
$reflection->getName(),
9090
));

src/V2/Support/VisibilityFilters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class VisibilityFilters
2323
'workflow_type' => 'Workflow Type',
2424
'business_key' => 'Business Key',
2525
'compatibility' => 'Compatibility',
26-
'declared_entry_mode' => 'Entry Mode',
26+
'declared_entry_mode' => 'Entry Contract',
2727
'declared_contract_source' => 'Command Contract Source',
2828
'queue' => 'Queue',
2929
'connection' => 'Connection',

tests/Unit/V2/VisibilityFiltersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function testDefinitionDescribesExactVisibilityContract(): void
259259
'Exact-match indexed operator metadata copied onto the run summary and saved-view contract.',
260260
$definition['fields']['business_key']['help'],
261261
);
262-
$this->assertSame('Entry Mode', $definition['fields']['declared_entry_mode']['label']);
262+
$this->assertSame('Entry Contract', $definition['fields']['declared_entry_mode']['label']);
263263
$this->assertSame('string', $definition['fields']['declared_entry_mode']['type']);
264264
$this->assertSame('select', $definition['fields']['declared_entry_mode']['input']);
265265
$this->assertSame('Canonical', $definition['fields']['declared_entry_mode']['options'][0]['label']);

0 commit comments

Comments
 (0)