Skip to content

Commit 2596ea5

Browse files
authored
Rename InitMethod to WorkflowInit (#564)
1 parent c84754a commit 2596ea5

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/Internal/Declaration/WorkflowInstance.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Temporal\Internal\Declaration\Prototype\WorkflowPrototype;
2121
use Temporal\Internal\Declaration\WorkflowInstance\SignalQueue;
2222
use Temporal\Internal\Interceptor;
23-
use Temporal\Workflow\InitMethod;
23+
use Temporal\Workflow\WorkflowInit;
2424

2525
/**
2626
* @psalm-type QueryHandler = \Closure(QueryInput): mixed
@@ -155,7 +155,7 @@ public function init(array $arguments = []): void
155155

156156
// Check InitMethod attribute
157157
$reflection = new \ReflectionMethod($this->context, '__construct');
158-
$attributes = $reflection->getAttributes(InitMethod::class);
158+
$attributes = $reflection->getAttributes(WorkflowInit::class);
159159
$attributes === []
160160
? $this->context->__construct()
161161
: $this->context->__construct(...$arguments);

src/Internal/Declaration/WorkflowInstanceInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface WorkflowInstanceInterface extends InstanceInterface
2525
{
2626
/**
2727
* Trigger constructor in Process context.
28-
* If the constructor is tagged with {@see \Temporal\Workflow\InitMethod} attribute,
28+
* If the constructor is tagged with {@see \Temporal\Workflow\WorkflowInit} attribute,
2929
* it will be executed with the {@see \Temporal\Workflow\WorkflowMethod} arguments.
3030
*/
3131
public function init(array $arguments = []): void;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
* @Target({ "METHOD" })
2222
*/
2323
#[\Attribute(\Attribute::TARGET_METHOD)]
24-
final class InitMethod {}
24+
final class WorkflowInit {}

tests/Acceptance/Extra/Workflow/InitMethodTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Temporal\Exception\Failure\TimeoutFailure;
1111
use Temporal\Tests\Acceptance\App\Attribute\Stub;
1212
use Temporal\Tests\Acceptance\App\TestCase;
13-
use Temporal\Workflow\InitMethod;
13+
use Temporal\Workflow\WorkflowInit;
1414
use Temporal\Workflow\WorkflowInterface;
1515
use Temporal\Workflow\WorkflowMethod;
1616

@@ -57,7 +57,7 @@ class TestWorkflow
5757
{
5858
private array $initInput;
5959

60-
#[InitMethod]
60+
#[WorkflowInit]
6161
public function __construct(Input $input)
6262
{
6363
$this->initInput = \func_get_args();
@@ -75,7 +75,7 @@ class TestWorkflowEmptyConstructor
7575
{
7676
private array $initInput;
7777

78-
#[InitMethod]
78+
#[WorkflowInit]
7979
public function __construct()
8080
{
8181
$this->initInput = \func_get_args();
@@ -93,7 +93,7 @@ class TestWorkflowDifferentConstructorParams
9393
{
9494
private array $initInput;
9595

96-
#[InitMethod]
96+
#[WorkflowInit]
9797
public function __construct(\stdClass $input)
9898
{
9999
$this->initInput = \func_get_args();

0 commit comments

Comments
 (0)