Skip to content

Commit

Permalink
Make all properties in interceptor configs readonly. Activity input: …
Browse files Browse the repository at this point in the history
…add activity method reflection when possible
  • Loading branch information
roxblnfk committed Oct 18, 2023
1 parent 28affbc commit 5ef06ca
Show file tree
Hide file tree
Showing 27 changed files with 214 additions and 210 deletions.
8 changes: 2 additions & 6 deletions src/Interceptor/ActivityInbound/ActivityInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,21 @@

namespace Temporal\Interceptor\ActivityInbound;

use JetBrains\PhpStorm\Immutable;
use Temporal\DataConverter\ValuesInterface;
use Temporal\Interceptor\HeaderInterface;

/**
* @psalm-immutable
*/
#[Immutable]
class ActivityInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public ValuesInterface $arguments,
#[Immutable]
public HeaderInterface $header,
public readonly ValuesInterface $arguments,
public readonly HeaderInterface $header,
) {
}

Expand Down
5 changes: 1 addition & 4 deletions src/Interceptor/WorkflowClient/CancelInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@

namespace Temporal\Interceptor\WorkflowClient;

use JetBrains\PhpStorm\Immutable;
use Temporal\Workflow\WorkflowExecution;

/**
* @psalm-immutable
*/
#[Immutable]
class CancelInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public WorkflowExecution $workflowExecution,
public readonly WorkflowExecution $workflowExecution,
) {
}

Expand Down
14 changes: 4 additions & 10 deletions src/Interceptor/WorkflowClient/GetResultInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,22 @@

namespace Temporal\Interceptor\WorkflowClient;

use JetBrains\PhpStorm\Immutable;
use Temporal\Workflow\WorkflowExecution;

/**
* @psalm-immutable
*/
#[Immutable]
class GetResultInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public WorkflowExecution $workflowExecution,
#[Immutable]
public ?string $workflowType,
#[Immutable]
public ?int $timeout,
#[Immutable]
public mixed $type,
public readonly WorkflowExecution $workflowExecution,
public readonly ?string $workflowType,
public readonly ?int $timeout,
public readonly mixed $type,
) {
}

Expand Down
14 changes: 4 additions & 10 deletions src/Interceptor/WorkflowClient/QueryInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,23 @@

namespace Temporal\Interceptor\WorkflowClient;

use JetBrains\PhpStorm\Immutable;
use Temporal\DataConverter\ValuesInterface;
use Temporal\Workflow\WorkflowExecution;

/**
* @psalm-immutable
*/
#[Immutable]
class QueryInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public WorkflowExecution $workflowExecution,
#[Immutable]
public ?string $workflowType,
#[Immutable]
public string $queryType,
#[Immutable]
public ValuesInterface $arguments,
public readonly WorkflowExecution $workflowExecution,
public readonly ?string $workflowType,
public readonly string $queryType,
public readonly ValuesInterface $arguments,
) {
}

Expand Down
14 changes: 4 additions & 10 deletions src/Interceptor/WorkflowClient/SignalInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,23 @@

namespace Temporal\Interceptor\WorkflowClient;

use JetBrains\PhpStorm\Immutable;
use Temporal\DataConverter\ValuesInterface;
use Temporal\Workflow\WorkflowExecution;

/**
* @psalm-immutable
*/
#[Immutable]
class SignalInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public WorkflowExecution $workflowExecution,
#[Immutable]
public ?string $workflowType,
#[Immutable]
public string $signalName,
#[Immutable]
public ValuesInterface $arguments,
public readonly WorkflowExecution $workflowExecution,
public readonly ?string $workflowType,
public readonly string $signalName,
public readonly ValuesInterface $arguments,
) {
}

Expand Down
11 changes: 3 additions & 8 deletions src/Interceptor/WorkflowClient/SignalWithStartInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,21 @@

namespace Temporal\Interceptor\WorkflowClient;

use JetBrains\PhpStorm\Immutable;
use Temporal\DataConverter\ValuesInterface;

/**
* @psalm-immutable
*/
#[Immutable]
class SignalWithStartInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public StartInput $workflowStartInput,
#[Immutable]
public string $signalName,
#[Immutable]
public ValuesInterface $signalArguments,
public readonly StartInput $workflowStartInput,
public readonly string $signalName,
public readonly ValuesInterface $signalArguments,
) {
}

Expand Down
17 changes: 5 additions & 12 deletions src/Interceptor/WorkflowClient/StartInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,25 @@

namespace Temporal\Interceptor\WorkflowClient;

use JetBrains\PhpStorm\Immutable;
use Temporal\Client\WorkflowOptions;
use Temporal\DataConverter\ValuesInterface;
use Temporal\Interceptor\HeaderInterface;

/**
* @psalm-immutable
*/
#[Immutable]
class StartInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public string $workflowId,
#[Immutable]
public string $workflowType,
#[Immutable]
public HeaderInterface $header,
#[Immutable]
public ValuesInterface $arguments,
#[Immutable]
public WorkflowOptions $options,
public readonly string $workflowId,
public readonly string $workflowType,
public readonly HeaderInterface $header,
public readonly ValuesInterface $arguments,
public readonly WorkflowOptions $options,
) {
}

Expand Down
8 changes: 2 additions & 6 deletions src/Interceptor/WorkflowClient/TerminateInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@

namespace Temporal\Interceptor\WorkflowClient;

use JetBrains\PhpStorm\Immutable;
use Temporal\Workflow\WorkflowExecution;

/**
* @psalm-immutable
*/
#[Immutable]
class TerminateInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public WorkflowExecution $workflowExecution,
#[Immutable]
public string $reason,
public readonly WorkflowExecution $workflowExecution,
public readonly string $reason,
) {
}

Expand Down
8 changes: 2 additions & 6 deletions src/Interceptor/WorkflowInbound/QueryInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@

namespace Temporal\Interceptor\WorkflowInbound;

use JetBrains\PhpStorm\Immutable;
use Temporal\DataConverter\ValuesInterface;

/**
* @psalm-immutable
*/
#[Immutable]
class QueryInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public string $queryName,
#[Immutable]
public ValuesInterface $arguments,
public readonly string $queryName,
public readonly ValuesInterface $arguments,
) {
}

Expand Down
14 changes: 4 additions & 10 deletions src/Interceptor/WorkflowInbound/SignalInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,24 @@

namespace Temporal\Interceptor\WorkflowInbound;

use JetBrains\PhpStorm\Immutable;
use Temporal\DataConverter\ValuesInterface;
use Temporal\Interceptor\HeaderInterface;
use Temporal\Workflow\WorkflowInfo;

/**
* @psalm-immutable
*/
#[Immutable]
class SignalInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public string $signalName,
#[Immutable]
public WorkflowInfo $info,
#[Immutable]
public ValuesInterface $arguments,
#[Immutable]
public HeaderInterface $header,
public readonly string $signalName,
public readonly WorkflowInfo $info,
public readonly ValuesInterface $arguments,
public readonly HeaderInterface $header,
) {
}

Expand Down
11 changes: 3 additions & 8 deletions src/Interceptor/WorkflowInbound/WorkflowInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,23 @@

namespace Temporal\Interceptor\WorkflowInbound;

use JetBrains\PhpStorm\Immutable;
use Temporal\DataConverter\ValuesInterface;
use Temporal\Interceptor\HeaderInterface;
use Temporal\Workflow\WorkflowInfo;

/**
* @psalm-immutable
*/
#[Immutable]
class WorkflowInput
{
/**
* @no-named-arguments
* @internal Don't use the constructor. Use {@see self::with()} instead.
*/
public function __construct(
#[Immutable]
public WorkflowInfo $info,
#[Immutable]
public ValuesInterface $arguments,
#[Immutable]
public HeaderInterface $header,
public readonly WorkflowInfo $info,
public readonly ValuesInterface $arguments,
public readonly HeaderInterface $header,
) {
}

Expand Down
5 changes: 1 addition & 4 deletions src/Interceptor/WorkflowOutboundCalls/AwaitInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@

namespace Temporal\Interceptor\WorkflowOutboundCalls;

use JetBrains\PhpStorm\Immutable;
use React\Promise\PromiseInterface;

/**
* @psalm-immutable
*/
#[Immutable]
final class AwaitInput
{
/**
Expand All @@ -20,8 +18,7 @@ final class AwaitInput
* @param array<callable|PromiseInterface> $conditions
*/
public function __construct(
#[Immutable]
public array $conditions,
public readonly array $conditions,
) {
}

Expand Down
Loading

0 comments on commit 5ef06ca

Please sign in to comment.