diff --git a/README.md b/README.md index cb89c8e1..c8e17912 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,165 @@ # Temporal PHP SDK -[![CI Status](https://github.com/temporalio/sdk-php/actions/workflows/testing.yml/badge.svg)](https://github.com/temporalio/php-sdk/actions) -[![Stable Release](https://poser.pugx.org/temporal/sdk/version)](https://packagist.org/packages/temporal/sdk) -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftemporalio%2Fsdk-php.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftemporalio%2Fsdk-php?ref=badge_shield) - -## Introduction - Temporal is a distributed, scalable, durable, and highly available orchestration engine used to execute asynchronous long-running business logic in a scalable and resilient way. -"Temporal PHP SDK" is the framework for authoring workflows and activities using -PHP language. +Temporal PHP SDK is the framework for authoring [Workflows](https://docs.temporal.io/workflows) and [Activities](https://docs.temporal.io/activities) using PHP language. + +**Table of contents:** +- [Get starting](#get-starting) + - [Installation](#installation) + - [Usage](#usage) +- [Testing](#testing) +- [Dev environment](#dev-environment) + - [Temporal CLI](#temporal-cli) + - [Buggregator](#buggregator) +- [Resources](#resources) +- [License](#license) -## Installation +## Get starting -SDK is available as composer package and can be installed using the -following command in a root of your project: +### Installation + +Install the SDK using Composer: ```bash composer require temporal/sdk ``` -Make sure to install [RoadRunner](https://github.com/spiral/roadrunner) to enable workflow and activity consumption in your PHP workers. +[![PHP](https://img.shields.io/packagist/php-v/temporal/sdk.svg?style=flat-square&logo=php)](https://packagist.org/packages/temporal/sdk) +[![Stable Release](https://poser.pugx.org/temporal/sdk/version?style=flat-square)](https://packagist.org/packages/temporal/sdk) +[![Total DLoads](https://img.shields.io/packagist/dt/temporal/sdk.svg?style=flat-square)](https://packagist.org/packages/temporal/sdk/stats) +[![License](https://img.shields.io/packagist/l/temporal/sdk.svg?style=flat-square)](LICENSE.md) + +The SDK includes two main components: [Clients](https://docs.temporal.io/develop/php/temporal-clients) and Workers. +The Clients component is used to start, schedule, and manage Workflows; +the Workers component is used to execute Workflows and Activities. + +The Clients component requires the [`grpc`](https://pecl.php.net/package/grpc) extension, +and the Workers component requires [RoadRunner](https://roadrunner.dev). +It's recommended to use both components with the [`protobuf`](https://pecl.php.net/package/protobuf) extension +in production to improve performance. + +| | Client | Worker | +|--------------|-------------|-------------| +| RoadRunner | — | required | +| ext-grpc | required | — | +| ext-protobuf | recommended | recommended | + +To download RoadRunner, you can use the following command: + +```bash +./vendor/bin/rr get +``` -## Usage +### Usage -See [examples](https://github.com/temporalio/samples-php) to get started. +If you are using [Spiral](https://github.com/spiral/framework), +follow the [instructions in the documentation](https://spiral.dev/docs/temporal-configuration/). + +If you are using the SDK without integrations, the following sections of the documentation may be helpful: +- [How to run Worker Processes](https://docs.temporal.io/develop/php/core-application#run-a-dev-worker) +- [How to develop a basic Workflow](https://docs.temporal.io/develop/php/core-application#develop-workflows) +- [How to connect a Temporal Client to a Temporal Service](https://docs.temporal.io/develop/php/temporal-clients#connect-to-a-dev-cluster) +- [How to start a Workflow Execution](https://docs.temporal.io/develop/php/temporal-clients#start-workflow-execution) + +> [!NOTE] +> Check out [the repository with examples](https://github.com/temporalio/samples-php) of using the PHP SDK. + +> [!WARNING] +> Since version [`2.11.0`](https://github.com/temporalio/sdk-php/releases/tag/v2.11.0), +> [feature flags](https://github.com/temporalio/sdk-php/blob/master/src/Worker/FeatureFlags.php) were introduced +> that change the behavior of the entire PHP worker. +> It's recommended to disable deprecated behavior. ## Testing -See [testing manual](testing/Readme.md) to get started. +The PHP SDK includes a toolkit for testing Workflows. +There is [documentation](https://docs.temporal.io/develop/php/testing-suite) and [dev guide](testing/Readme.md) on how to test a Workflow using Activity mocking. + +To ensure the determinism of a Workflow, +you can also use the [Replay API in tests](https://docs.temporal.io/develop/php/testing-suite#replay). + +## Dev environment + +Some recommendations for setting up a development environment: + +### Temporal CLI + +The [Temporal CLI](https://docs.temporal.io/cli) provides direct access to a Temporal Service via the terminal. +You can use it to start, stop, inspect and operate on Workflows and Activities, +and perform administrative tasks such as Namespace, Schedule, and Task Queue management. +The Temporal CLI also includes an embedded Temporal Service suitable for use in development and CI/CD. +It includes the Temporal Server, SQLite persistence, and the Temporal Web UI. + +Run the following command to start the Temporal Service in development mode: + +```bash +temporal server start-dev --log-level error +``` + +Experimental features: +- Add flags `--dynamic-config-value frontend.enableUpdateWorkflowExecution=true --dynamic-config-value frontend.enableUpdateWorkflowExecutionAsyncAccepted=true` +to enable the [Workflow Update feature](https://docs.temporal.io/encyclopedia/workflow-message-passing#sending-updates). +- Add flag `--dynamic-config-value frontend.enableExecuteMultiOperation=true` to enable [`updateWithStart()` feature](https://php.temporal.io/classes/Temporal-Client-WorkflowClient.html#method_updateWithStart). +- Add flag `--dynamic-config-value system.enableEagerWorkflowStart=true` to enable the [Eager Workflow Start feature](https://docs.temporal.io/develop/advanced-start-options#eager-start). + +### Buggregator + +During development, you might need to dump a variable, throw an error trace, or simply look at the call stack. +Since Workflows and Activities run in RoadRunner workers, you cannot use `var_dump`, +`print_r`, `echo`, and other functions that output data to STDOUT. + +Instead, use [Buggregator](https://buggregator.dev) along with [Trap](https://github.com/buggregator/trap). +In this case, dumps, traces, and logs will be sent via socket to your local Buggregator server, +where you can view them in a convenient web interface. + +> [!TIP] +> Trap is a wrapper around `symfony/var-dumper`, providing additional debugging capabilities. +> Moreover, Trap patches var-dumper for outputting protobuf structures, which is very handy when working with Temporal. + +To run Buggregator in Docker, execute the command below +and follow the [instructions](https://docs.buggregator.dev/config/var-dumper.html#configuration): + +```bash +docker run --rm -p 8000:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 ghcr.io/buggregator/server:latest +``` + +If you are not using Docker or running PHP code outside a container, you can use Trap as a compact server: + +```bash +./vendor/bin/trap --ui=8000 +``` + +Now use the `trap()`, `tr()`, or `dump()` functions to output data to Buggregator. +Web UI will be available at `http://localhost:8000`. + +## Resources + +Read the docs +[![Temporal Documentation](https://img.shields.io/static/v1?style=flat-square&label=&message=Dcumentation&logo=Temporal&color=7744ee)](https://docs.temporal.io/) +[![PHP SDK Documentation](https://img.shields.io/static/v1?style=flat-square&label=PHP+SDK&message=Dev+guide&logo=Temporal&color=7766ee)](https://docs.temporal.io/develop/php) +[![PHP SDK API](https://img.shields.io/static/v1?style=flat-square&label=PHP+SDK&message=API&logo=PHP&color=447723&logoColor=aa88ff)](https://php.temporal.io/) + +Ask a question +[![Github issues](https://img.shields.io/static/v1?style=flat-square&label=&message=Issues&logo=Github&color=202020)](https://github.com/temporalio/sdk-php/issues) +[![Slack](https://img.shields.io/static/v1?style=flat-square&label=&message=Slack&logo=Slack&color=cc4444)](https://t.mp/slack) +[![Forum](https://img.shields.io/static/v1?style=flat-square&label=&message=Forum&logo=Discourse&color=4477ee)](https://community.temporal.io/tag/php-sdk) +[![Discord](https://img.shields.io/static/v1?style=flat-square&label=&message=Discord&logo=Discord&color=333333)](https://discord.gg/FwmDtGQe55) + +Stay tuned +[![Read Blog](https://img.shields.io/static/v1?style=flat-square&label=&message=Read+the+Blog&logo=Temporal&color=312f2b)](https://temporal.io/blog) +[![Temporal YT Channel](https://img.shields.io/static/v1?style=flat-square&label=&message=Watch+on+Youtube&logo=youtube&color=b9002a)](https://www.youtube.com/temporalio) +[![X](https://img.shields.io/badge/-Follow-black?style=flat-square&logo=X)](https://x.com/temporalio) + +Additionally +[![Temporal community](https://img.shields.io/static/v1?style=flat-square&label=&message=Community&color=ff6644&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI5NyIgaGVpZ2h0PSI3NiI+PHBhdGggZD0iTTQyLjc0MDMgMTYuNTYyMkM0My43MjA0IDE3LjI3NzUgNDcuNjY3MyAyMC40Mjk3IDQ4LjY0NzQgMjEuMTk3OUM0OS42Mjc1IDIwLjM3NjcgNTMuNTc0NCAxNy4yNzc1IDU0LjU1NDUgMTYuNTYyMkM3NC41Mjc0IDEuNjIyMjggOTAuNTAwNSAtMi44MDE0MiA5NC45NTA3IDEuNjQ4NzhDOTkuNDAwOSA2LjA5ODk4IDk1LjAwMzcgMjIuMDQ1NSA4MC4wMzcyIDQyLjA0NUM3OS4zMjIgNDMuMDI1MSA3Ni4xNjk4IDQ2Ljk3MiA3NS40MDE2IDQ3Ljk1MjFDNzEuNjY2NiA1Mi40ODE3IDY3LjQ4MTMgNTcuMTk2OCA2Mi42ODY3IDYxLjk5MTRDNTcuODkyMSA2Ni43ODYgNTMuMjMgNzAuOTcxMyA0OC42NDc0IDc0LjcwNjNDNDQuMTE3NyA3MC45NzEzIDM5LjQwMjYgNjYuNzg2IDM0LjYwOCA2MS45OTE0QzI5LjgxMzUgNTcuMTk2OCAyNS42MjgyIDUyLjUzNDcgMjEuODkzMiA0Ny45NTIxQzIxLjA3MiA0Ni45NzIgMTcuOTcyOCA0My4wMjUxIDE3LjI1NzYgNDIuMDQ1QzIuMzE3NiAyMi4wNzIgLTIuMTA2MTEgNi4wOTg5OSAyLjM0NDA5IDEuNjQ4NzlDNi43OTQyOSAtMi44MDE0MSAyMi43NjczIDEuNjIyMjcgNDIuNzQwMyAxNi41NjIyWiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==)](https://temporal.io/community) +[![Awesome Temporal](https://img.shields.io/static/v1?style=flat-square&label=&message=Awesome+Temporal&logo=Awesome-Lists&color=4b4567)](https://github.com/temporalio/awesome-temporal) -## Documentation -The documentation on how to use the Temporal PHP SDK and client is [here](https://docs.temporal.io/). ## License -MIT License, please see [LICENSE](LICENSE.md) for details. +Temporal PHP SDK is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftemporalio%2Fsdk-php.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftemporalio%2Fsdk-php?ref=badge_large) diff --git a/src/Activity/ActivityContextInterface.php b/src/Activity/ActivityContextInterface.php index 7128a6da..13d00592 100644 --- a/src/Activity/ActivityContextInterface.php +++ b/src/Activity/ActivityContextInterface.php @@ -21,7 +21,6 @@ interface ActivityContextInterface * Returns information about current activity execution. * * @see Activity::getInfo() - * */ public function getInfo(): ActivityInfo; @@ -29,7 +28,6 @@ public function getInfo(): ActivityInfo; * Returns activity execution input arguments. * * @see Activity::getInput() - * */ public function getInput(): ValuesInterface; @@ -37,7 +35,6 @@ public function getInput(): ValuesInterface; * Check if the heartbeat's first argument has been passed. * * @see Activity::hasHeartbeatDetails() - * */ public function hasHeartbeatDetails(): bool; @@ -55,7 +52,6 @@ public function getHeartbeatDetails($type = null); * Marks the activity as incomplete for asynchronous completion. * * @see Activity::doNotCompleteOnReturn() - * */ public function doNotCompleteOnReturn(): void; diff --git a/src/Activity/ActivityInfo.php b/src/Activity/ActivityInfo.php index a5866063..f7350be2 100644 --- a/src/Activity/ActivityInfo.php +++ b/src/Activity/ActivityInfo.php @@ -37,7 +37,6 @@ final class ActivityInfo * A correlation token that can be used to complete the activity through `complete` method. * * @see ActivityCompletionClientInterface::complete() - * */ #[Marshal(name: 'TaskToken')] public string $taskToken; @@ -56,14 +55,12 @@ final class ActivityInfo * activity through `complete` method. * * @see ActivityCompletionClientInterface::complete() - * */ #[Marshal(name: 'ActivityID')] public string $id; /** * Type (name) of the activity. - * */ #[Marshal(name: 'ActivityType', type: ObjectType::class, of: ActivityType::class)] public ActivityType $type; @@ -73,28 +70,24 @@ final class ActivityInfo /** * Maximum time between heartbeats. 0 means no heartbeat needed. - * */ #[Marshal(name: 'HeartbeatTimeout', type: DateIntervalType::class)] public \DateInterval $heartbeatTimeout; /** * Time of activity scheduled by a workflow - * */ #[Marshal(name: 'ScheduledTime', type: DateTimeType::class)] public \DateTimeInterface $scheduledTime; /** * Time of activity start - * */ #[Marshal(name: 'StartedTime', type: DateTimeType::class)] public \DateTimeInterface $startedTime; /** * Time of activity timeout - * */ #[Marshal(name: 'Deadline', type: DateTimeType::class)] public \DateTimeInterface $deadline; @@ -102,7 +95,6 @@ final class ActivityInfo /** * Attempt starts from 1, and increased by 1 for every retry if * retry policy is specified. - * */ #[Marshal(name: 'Attempt')] public int $attempt = 1; diff --git a/src/Client/Common/RpcRetryOptions.php b/src/Client/Common/RpcRetryOptions.php index 9b0c25c3..5ebc8674 100644 --- a/src/Client/Common/RpcRetryOptions.php +++ b/src/Client/Common/RpcRetryOptions.php @@ -73,7 +73,6 @@ public function withCongestionInitialInterval($interval): self * * @param null|float $coefficient Maximum amount of jitter. * Default will be used if set to {@see null}. - * */ #[Pure] public function withMaximumJitterCoefficient(?float $coefficient): self diff --git a/src/Client/GRPC/BaseClient.php b/src/Client/GRPC/BaseClient.php index 0bf0223c..f3d6bfc2 100644 --- a/src/Client/GRPC/BaseClient.php +++ b/src/Client/GRPC/BaseClient.php @@ -165,7 +165,6 @@ public function close(): void /** * @param null|Pipeline $pipeline - * */ final public function withInterceptorPipeline(?Pipeline $pipeline): static { diff --git a/src/Client/Update/UpdateHandle.php b/src/Client/Update/UpdateHandle.php index ccf91366..f8f3de77 100644 --- a/src/Client/Update/UpdateHandle.php +++ b/src/Client/Update/UpdateHandle.php @@ -56,7 +56,6 @@ public function getId(): string /** * Check there is a cached accepted result or failure for this update request. - * */ public function hasResult(): bool { diff --git a/src/Client/WorkflowClient.php b/src/Client/WorkflowClient.php index 22097b5e..2cf3419d 100644 --- a/src/Client/WorkflowClient.php +++ b/src/Client/WorkflowClient.php @@ -94,17 +94,16 @@ public static function create( return new self($serviceClient, $options, $converter, $interceptorProvider); } + /** + * @inheritDoc + */ public function getServiceClient(): ServiceClientInterface { return $this->client; } /** - * Starts workflow in async mode. Returns WorkflowRun object which can be used to wait for the execution result. - * WorkflowRun objects created by typed workflow stubs will attempt to type the execution result as well. - * - * @param object|WorkflowStubInterface $workflow - * @param mixed ...$args + * @inheritDoc */ public function start($workflow, ...$args): WorkflowRunInterface { @@ -148,6 +147,9 @@ public function start($workflow, ...$args): WorkflowRunInterface ); } + /** + * @inheritDoc + */ public function signalWithStart( $workflow, string $signal, @@ -206,6 +208,9 @@ public function signalWithStart( ); } + /** + * @inheritDoc + */ #[Deprecated(replacement: '%class%->signalWithStart(%parametersList%)')] public function startWithSignal( $workflow, @@ -216,6 +221,9 @@ public function startWithSignal( return $this->signalWithStart($workflow, $signal, $signalArgs, $startArgs); } + /** + * @inheritDoc + */ public function updateWithStart( $workflow, string|UpdateOptions $update, @@ -250,6 +258,9 @@ public function updateWithStart( : $handle; } + /** + * @inheritDoc + */ public function newWorkflowStub( string $class, ?WorkflowOptions $options = null, @@ -263,6 +274,9 @@ public function newWorkflowStub( ); } + /** + * @inheritDoc + */ public function newUntypedWorkflowStub( string $workflowType, ?WorkflowOptions $options = null, @@ -279,6 +293,9 @@ public function newUntypedWorkflowStub( ); } + /** + * @inheritDoc + */ public function newRunningWorkflowStub(string $class, string $workflowID, ?string $runID = null): object { $workflow = $this->reader->fromClass($class); @@ -290,6 +307,9 @@ public function newRunningWorkflowStub(string $class, string $workflowID, ?strin ); } + /** + * @inheritDoc + */ public function newUntypedRunningWorkflowStub( string $workflowID, ?string $runID = null, @@ -307,11 +327,17 @@ public function newUntypedRunningWorkflowStub( return $untyped; } + /** + * @inheritDoc + */ public function newActivityCompletionClient(): ActivityCompletionClientInterface { return new ActivityCompletionClient($this->client, $this->clientOptions, $this->converter); } + /** + * @inheritDoc + */ public function listWorkflowExecutions( string $query, ?string $namespace = null, @@ -348,6 +374,9 @@ public function listWorkflowExecutions( return Paginator::createFromGenerator($loader($request), $counter); } + /** + * @inheritDoc + */ public function countWorkflowExecutions( string $query, ?string $namespace = null, @@ -363,6 +392,9 @@ public function countWorkflowExecutions( ); } + /** + * @inheritDoc + */ public function getWorkflowHistory( WorkflowExecution $execution, ?string $namespace = null, diff --git a/src/Client/WorkflowClientInterface.php b/src/Client/WorkflowClientInterface.php index c8466555..de1cb076 100644 --- a/src/Client/WorkflowClientInterface.php +++ b/src/Client/WorkflowClientInterface.php @@ -29,10 +29,13 @@ interface WorkflowClientInterface extends ClientContextInterface public function getServiceClient(): ServiceClientInterface; /** - * Starts untyped and typed workflow stubs in async mode. + * Starts workflow in async mode. + * + * Returns WorkflowRun object which can be used to wait for the execution result. + * WorkflowRun objects created by typed workflow stubs will attempt to type the execution result as well. * * @param WorkflowStubInterface|object $workflow - * @param mixed $args + * @param mixed ...$args */ public function start($workflow, ...$args): WorkflowRunInterface; @@ -111,7 +114,6 @@ public function newWorkflowStub( * * IMPORTANT! Stub is per workflow instance. So new stub should be created * for each new one. - * */ public function newUntypedWorkflowStub( string $workflowType, @@ -133,7 +135,6 @@ public function newRunningWorkflowStub( /** * Returns untyped workflow stub associated with running workflow. - * */ public function newUntypedRunningWorkflowStub( string $workflowID, @@ -148,7 +149,6 @@ public function newUntypedRunningWorkflowStub( * Only relevant for activity implementations that called {@see ActivityContext::doNotCompleteOnReturn()}. * * @see ActivityCompletionClient - * */ public function newActivityCompletionClient(): ActivityCompletionClientInterface; @@ -203,7 +203,6 @@ public function countWorkflowExecutions( * Available values are {@see HistoryEventFilterType} constants. * @param int<0, max> $pageSize Size of the pages to be requested. It affects internal queries only. Use it if you * want to load limited number of events from the history. - * */ public function getWorkflowHistory( WorkflowExecution $execution, diff --git a/src/Client/WorkflowStubInterface.php b/src/Client/WorkflowStubInterface.php index 618f4fee..dd373066 100644 --- a/src/Client/WorkflowStubInterface.php +++ b/src/Client/WorkflowStubInterface.php @@ -40,7 +40,6 @@ public function getWorkflowType(): ?string; /** * Returns associated workflow options. Empty for running workflows. Workflow options are immutable and can * not be changed after the workflow was created. - * */ public function getOptions(): ?WorkflowOptions; @@ -53,13 +52,11 @@ public function getExecution(): WorkflowExecution; /** * Check if workflow was started and has associated execution. - * */ public function hasExecution(): bool; /** * Attaches running workflow context to the workflow stub. - * */ public function setExecution(WorkflowExecution $execution): void; @@ -122,7 +119,6 @@ public function getUpdateHandle(string $updateId, mixed $resultType = null): Upd * Cancellation cancels {@see CancellationScopeInterface} that wraps the * main workflow method. Note that workflow can take long time to get * canceled or even completely ignore the cancellation request. - * */ public function cancel(): void; @@ -131,7 +127,6 @@ public function cancel(): void; * * Termination is a hard stop of a workflow execution which doesn't give * workflow code any chance to perform cleanup. - * */ public function terminate(string $reason, array $details = []): void; } diff --git a/src/Common/CronSchedule.php b/src/Common/CronSchedule.php index abc9141e..3a9ef758 100644 --- a/src/Common/CronSchedule.php +++ b/src/Common/CronSchedule.php @@ -49,7 +49,6 @@ final class CronSchedule implements \Stringable * │ │ │ │ │ * * * * * * * ``` - * */ #[Immutable] public string $interval; diff --git a/src/DataConverter/EncodedValues.php b/src/DataConverter/EncodedValues.php index bb0ed99f..81e371d4 100644 --- a/src/DataConverter/EncodedValues.php +++ b/src/DataConverter/EncodedValues.php @@ -75,7 +75,6 @@ public static function sliceValues( * Decode promise response upon returning it to the domain layer. * * @param string|\ReflectionClass|\ReflectionType|Type|null $type - * */ public static function decodePromise(PromiseInterface $promise, $type = null): PromiseInterface { @@ -101,7 +100,6 @@ public static function fromValues(array $values, ?DataConverterInterface $dataCo /** * @param TPayloadsCollection $payloads - * */ public static function fromPayloadCollection( \Traversable $payloads, diff --git a/src/DataConverter/PayloadConverterInterface.php b/src/DataConverter/PayloadConverterInterface.php index 464683f5..24b12578 100644 --- a/src/DataConverter/PayloadConverterInterface.php +++ b/src/DataConverter/PayloadConverterInterface.php @@ -18,7 +18,6 @@ interface PayloadConverterInterface { /** * Returns associated encoding type. - * */ public function getEncodingType(): string; diff --git a/src/DataConverter/ValuesInterface.php b/src/DataConverter/ValuesInterface.php index 27ddea51..f1d3a662 100644 --- a/src/DataConverter/ValuesInterface.php +++ b/src/DataConverter/ValuesInterface.php @@ -22,7 +22,6 @@ interface ValuesInterface extends \Countable { /** * Checks if any value present. - * */ public function isEmpty(): bool; @@ -41,7 +40,6 @@ public function getValue(int $index, $type); /** * Returns associated payloads. - * */ public function toPayloads(): Payloads; } diff --git a/src/Exception/Failure/TemporalFailure.php b/src/Exception/Failure/TemporalFailure.php index f10c87f6..8fdee6c7 100644 --- a/src/Exception/Failure/TemporalFailure.php +++ b/src/Exception/Failure/TemporalFailure.php @@ -93,7 +93,6 @@ public function __toString(): string /** * Explain known types of key=>value pairs. - * */ protected static function buildMessage(array $values): string { diff --git a/src/Interceptor/ActivityInboundInterceptor.php b/src/Interceptor/ActivityInboundInterceptor.php index 16fd8122..299b2697 100644 --- a/src/Interceptor/ActivityInboundInterceptor.php +++ b/src/Interceptor/ActivityInboundInterceptor.php @@ -27,7 +27,6 @@ interface ActivityInboundInterceptor extends Interceptor * Intercepts a call to the main activity entry method. * * @param callable(ActivityInput): mixed $next - * */ public function handleActivityInbound(ActivityInput $input, callable $next): mixed; } diff --git a/src/Interceptor/GrpcClientInterceptor.php b/src/Interceptor/GrpcClientInterceptor.php index 2d36e14b..5a183208 100644 --- a/src/Interceptor/GrpcClientInterceptor.php +++ b/src/Interceptor/GrpcClientInterceptor.php @@ -24,7 +24,6 @@ interface GrpcClientInterceptor extends Interceptor * * @param non-empty-string $method * @param callable(non-empty-string, object, ContextInterface): object $next - * */ public function interceptCall(string $method, object $arg, ContextInterface $ctx, callable $next): object; } diff --git a/src/Interceptor/Trait/WorkflowOutboundRequestInterceptorTrait.php b/src/Interceptor/Trait/WorkflowOutboundRequestInterceptorTrait.php index 992ff7a7..3be08a3c 100644 --- a/src/Interceptor/Trait/WorkflowOutboundRequestInterceptorTrait.php +++ b/src/Interceptor/Trait/WorkflowOutboundRequestInterceptorTrait.php @@ -61,7 +61,6 @@ final public function handleOutboundRequest(RequestInterface $request, callable /** * @param callable(ExecuteActivity): PromiseInterface $next - * */ private function executeActivityRequest(ExecuteActivity $request, callable $next): PromiseInterface { @@ -70,7 +69,6 @@ private function executeActivityRequest(ExecuteActivity $request, callable $next /** * @param callable(ExecuteLocalActivity): PromiseInterface $next - * */ private function executeLocalActivityRequest(ExecuteLocalActivity $request, callable $next): PromiseInterface { @@ -79,7 +77,6 @@ private function executeLocalActivityRequest(ExecuteLocalActivity $request, call /** * @param callable(ExecuteChildWorkflow): PromiseInterface $next - * */ private function executeChildWorkflowRequest(ExecuteChildWorkflow $request, callable $next): PromiseInterface { @@ -88,7 +85,6 @@ private function executeChildWorkflowRequest(ExecuteChildWorkflow $request, call /** * @param callable(NewTimer): PromiseInterface $next - * */ private function newTimerRequest(NewTimer $request, callable $next): PromiseInterface { @@ -97,7 +93,6 @@ private function newTimerRequest(NewTimer $request, callable $next): PromiseInte /** * @param callable(ContinueAsNew): PromiseInterface $next - * */ private function continueAsNewRequest(ContinueAsNew $request, callable $next): PromiseInterface { @@ -106,7 +101,6 @@ private function continueAsNewRequest(ContinueAsNew $request, callable $next): P /** * @param callable(SignalExternalWorkflow): PromiseInterface $next - * */ private function signalExternalWorkflowRequest(SignalExternalWorkflow $request, callable $next): PromiseInterface { @@ -115,7 +109,6 @@ private function signalExternalWorkflowRequest(SignalExternalWorkflow $request, /** * @param callable(CompleteWorkflow): PromiseInterface $next - * */ private function completeWorkflowRequest(CompleteWorkflow $request, callable $next): PromiseInterface { @@ -124,7 +117,6 @@ private function completeWorkflowRequest(CompleteWorkflow $request, callable $ne /** * @param callable(CancelExternalWorkflow): PromiseInterface $next - * */ private function cancelExternalWorkflowRequest(CancelExternalWorkflow $request, callable $next): PromiseInterface { @@ -133,7 +125,6 @@ private function cancelExternalWorkflowRequest(CancelExternalWorkflow $request, /** * @param callable(GetVersion): PromiseInterface $next - * */ private function getVersionRequest(GetVersion $request, callable $next): PromiseInterface { @@ -142,7 +133,6 @@ private function getVersionRequest(GetVersion $request, callable $next): Promise /** * @param callable(Panic): PromiseInterface $next - * */ private function panicRequest(Panic $request, callable $next): PromiseInterface { @@ -151,7 +141,6 @@ private function panicRequest(Panic $request, callable $next): PromiseInterface /** * @param callable(SideEffect): PromiseInterface $next - * */ private function sideEffectRequest(SideEffect $request, callable $next): PromiseInterface { @@ -160,7 +149,6 @@ private function sideEffectRequest(SideEffect $request, callable $next): Promise /** * @param callable(UpsertSearchAttributes): PromiseInterface $next - * */ private function upsertSearchAttributesRequest(UpsertSearchAttributes $request, callable $next): PromiseInterface { @@ -169,7 +157,6 @@ private function upsertSearchAttributesRequest(UpsertSearchAttributes $request, /** * @param callable(Cancel): PromiseInterface $next - * */ private function cancelRequest(Cancel $request, callable $next): PromiseInterface { diff --git a/src/Interceptor/WorkflowOutboundCallsInterceptor.php b/src/Interceptor/WorkflowOutboundCallsInterceptor.php index 7b078a2c..2f875458 100644 --- a/src/Interceptor/WorkflowOutboundCallsInterceptor.php +++ b/src/Interceptor/WorkflowOutboundCallsInterceptor.php @@ -55,7 +55,6 @@ interface WorkflowOutboundCallsInterceptor extends Interceptor { /** * @param callable(ExecuteActivityInput): PromiseInterface $next - * */ public function executeActivity( ExecuteActivityInput $input, @@ -64,25 +63,21 @@ public function executeActivity( /** * @param callable(ExecuteLocalActivityInput): PromiseInterface $next - * */ public function executeLocalActivity(ExecuteLocalActivityInput $input, callable $next): PromiseInterface; /** * @param callable(ExecuteChildWorkflowInput): PromiseInterface $next - * */ public function executeChildWorkflow(ExecuteChildWorkflowInput $input, callable $next): PromiseInterface; /** * @param callable(SignalExternalWorkflowInput): PromiseInterface $next - * */ public function signalExternalWorkflow(SignalExternalWorkflowInput $input, callable $next): PromiseInterface; /** * @param callable(CancelExternalWorkflowInput): PromiseInterface $next - * */ public function cancelExternalWorkflow(CancelExternalWorkflowInput $input, callable $next): PromiseInterface; @@ -97,49 +92,41 @@ public function sideEffect(SideEffectInput $input, callable $next): mixed; /** * @param callable(TimerInput): PromiseInterface $next - * */ public function timer(TimerInput $input, callable $next): PromiseInterface; /** * @param callable(PanicInput): PromiseInterface $next - * */ public function panic(PanicInput $input, callable $next): PromiseInterface; /** * @param callable(CompleteInput): PromiseInterface $next - * */ public function complete(CompleteInput $input, callable $next): PromiseInterface; /** * @param callable(ContinueAsNewInput): PromiseInterface $next - * */ public function continueAsNew(ContinueAsNewInput $input, callable $next): PromiseInterface; /** * @param callable(GetVersionInput): PromiseInterface $next - * */ public function getVersion(GetVersionInput $input, callable $next): PromiseInterface; /** * @param callable(UpsertSearchAttributesInput): PromiseInterface $next - * */ public function upsertSearchAttributes(UpsertSearchAttributesInput $input, callable $next): PromiseInterface; /** * @param callable(AwaitInput): PromiseInterface $next - * */ public function await(AwaitInput $input, callable $next): PromiseInterface; /** * @param callable(AwaitWithTimeoutInput): PromiseInterface $next - * */ public function awaitWithTimeout(AwaitWithTimeoutInput $input, callable $next): PromiseInterface; } diff --git a/src/Interceptor/WorkflowOutboundRequestInterceptor.php b/src/Interceptor/WorkflowOutboundRequestInterceptor.php index 9619a100..0562693e 100644 --- a/src/Interceptor/WorkflowOutboundRequestInterceptor.php +++ b/src/Interceptor/WorkflowOutboundRequestInterceptor.php @@ -40,7 +40,6 @@ interface WorkflowOutboundRequestInterceptor extends Interceptor { /** * @param callable(RequestInterface): PromiseInterface $next - * */ public function handleOutboundRequest(RequestInterface $request, callable $next): PromiseInterface; } diff --git a/src/Internal/Client/WorkflowStub.php b/src/Internal/Client/WorkflowStub.php index 7a6dbc1f..b0a0fc13 100644 --- a/src/Internal/Client/WorkflowStub.php +++ b/src/Internal/Client/WorkflowStub.php @@ -118,7 +118,6 @@ public function getExecution(): WorkflowExecution /** * Connects stub to running workflow. - * */ public function setExecution(WorkflowExecution $execution): void { diff --git a/src/Internal/Declaration/Dispatcher/Dispatcher.php b/src/Internal/Declaration/Dispatcher/Dispatcher.php index 8d5bcc18..b2c459f0 100644 --- a/src/Internal/Declaration/Dispatcher/Dispatcher.php +++ b/src/Internal/Declaration/Dispatcher/Dispatcher.php @@ -129,7 +129,6 @@ private function createExecutorFromFunction(\ReflectionFunction $fun): \Closure /** * @psalm-return FunctionExecutor - * */ private function boot(\ReflectionFunctionAbstract $fun): void { diff --git a/src/Internal/Declaration/Prototype/PrototypeInterface.php b/src/Internal/Declaration/Prototype/PrototypeInterface.php index a3e293ea..f8a4bf36 100644 --- a/src/Internal/Declaration/Prototype/PrototypeInterface.php +++ b/src/Internal/Declaration/Prototype/PrototypeInterface.php @@ -17,19 +17,16 @@ interface PrototypeInterface extends Identifiable { /** * Returns the name of the main handler. - * */ public function getID(): string; /** * Returns a link to the class within which the handler is defined. - * */ public function getClass(): \ReflectionClass; /** * Returns the reflection of the handler function. - * */ public function getHandler(): ?\ReflectionMethod; } diff --git a/src/Internal/Marshaller/Type/ArrayType.php b/src/Internal/Marshaller/Type/ArrayType.php index be6ae4db..fd63dc4e 100644 --- a/src/Internal/Marshaller/Type/ArrayType.php +++ b/src/Internal/Marshaller/Type/ArrayType.php @@ -82,7 +82,6 @@ public function parse($value, $current): array /** * @param iterable $value - * */ public function serialize($value): array { diff --git a/src/Internal/Marshaller/Type/RuleFactoryInterface.php b/src/Internal/Marshaller/Type/RuleFactoryInterface.php index 753ce7a8..b8a3a747 100644 --- a/src/Internal/Marshaller/Type/RuleFactoryInterface.php +++ b/src/Internal/Marshaller/Type/RuleFactoryInterface.php @@ -22,7 +22,6 @@ interface RuleFactoryInterface extends TypeInterface { /** * Make a marshalling rule for the given property. - * */ public static function makeRule(\ReflectionProperty $property): ?MarshallingRule; } diff --git a/src/Internal/Marshaller/TypeFactoryInterface.php b/src/Internal/Marshaller/TypeFactoryInterface.php index 338ad115..96596cb5 100644 --- a/src/Internal/Marshaller/TypeFactoryInterface.php +++ b/src/Internal/Marshaller/TypeFactoryInterface.php @@ -17,7 +17,6 @@ interface TypeFactoryInterface { /** * @param class-string $type - * */ public function create(string $type, array $args): ?TypeInterface; diff --git a/src/Internal/Repository/RepositoryInterface.php b/src/Internal/Repository/RepositoryInterface.php index 2078d072..d597dba7 100644 --- a/src/Internal/Repository/RepositoryInterface.php +++ b/src/Internal/Repository/RepositoryInterface.php @@ -30,7 +30,6 @@ public function filter(callable $filter): self; /** * Register a new {@see Identifiable} inside the repository. - * */ public function add(Identifiable $entry, bool $overwrite = false): void; diff --git a/src/Internal/Support/Process.php b/src/Internal/Support/Process.php index f08b5038..bb44d3ea 100644 --- a/src/Internal/Support/Process.php +++ b/src/Internal/Support/Process.php @@ -20,7 +20,6 @@ class Process { /** * Run process with arguments and get result. - * */ public static function run(string ...$cmd): string { diff --git a/src/Internal/Support/StackRenderer.php b/src/Internal/Support/StackRenderer.php index 6cc8ce15..1bf214e3 100644 --- a/src/Internal/Support/StackRenderer.php +++ b/src/Internal/Support/StackRenderer.php @@ -15,7 +15,6 @@ class StackRenderer { /** * Sets files and prefixes to be ignored from the stack trace. - * */ private static array $ignorePaths = [ 'temporal/sdk/src/Internal/', @@ -31,7 +30,6 @@ public static function setIgnoredPaths(array $files): void /** * Renders trace in easy to digest form, removes references to internal functionality. - * */ public static function renderTrace(array $stackTrace): string { diff --git a/src/Internal/Transport/ClientInterface.php b/src/Internal/Transport/ClientInterface.php index 4e2ab2a9..e1862aaf 100644 --- a/src/Internal/Transport/ClientInterface.php +++ b/src/Internal/Transport/ClientInterface.php @@ -30,7 +30,6 @@ public function send(CommandInterface $request): void; /** * Check if command still in sending queue. - * */ public function isQueued(CommandInterface $command): bool; @@ -38,7 +37,6 @@ public function cancel(CommandInterface $command): void; /** * Reject pending promise. - * */ public function reject(CommandInterface $command, \Throwable $reason): void; } diff --git a/src/Internal/Transport/CompletableResult.php b/src/Internal/Transport/CompletableResult.php index b57a0dbb..fec440de 100644 --- a/src/Internal/Transport/CompletableResult.php +++ b/src/Internal/Transport/CompletableResult.php @@ -72,7 +72,6 @@ public function getValue() /** * @param (callable(mixed): mixed)|null $onFulfilled * @param (callable(\Throwable): mixed)|null $onRejected - * */ public function then( ?callable $onFulfilled = null, diff --git a/src/Internal/Workflow/Process/Scope.php b/src/Internal/Workflow/Process/Scope.php index eb961f75..1782f94b 100644 --- a/src/Internal/Workflow/Process/Scope.php +++ b/src/Internal/Workflow/Process/Scope.php @@ -43,13 +43,11 @@ class Scope implements CancellationScopeInterface, Destroyable /** * Workflow context. - * */ protected WorkflowContext $context; /** * Coroutine scope context. - * */ protected ScopeContext $scopeContext; @@ -275,7 +273,6 @@ public function always(callable $onFulfilledOrRejected): PromiseInterface /** * Connects promise to scope context to be cancelled on promise cancel. - * */ public function onAwait(Deferred $deferred): void { diff --git a/src/Internal/Workflow/WorkflowContext.php b/src/Internal/Workflow/WorkflowContext.php index d42d4d28..eb4729ff 100644 --- a/src/Internal/Workflow/WorkflowContext.php +++ b/src/Internal/Workflow/WorkflowContext.php @@ -611,7 +611,6 @@ protected function addCondition(string $conditionGroupId, callable $condition): /** * Record last stack trace of the call. - * */ protected function recordTrace(): void { diff --git a/src/Worker/ServiceCredentials.php b/src/Worker/ServiceCredentials.php index 536f72bf..29bc3568 100644 --- a/src/Worker/ServiceCredentials.php +++ b/src/Worker/ServiceCredentials.php @@ -30,10 +30,12 @@ public static function create(): self * * To update the API key in runtime, call the `UpdateAPIKey` RPC method with the new key: * - * $result = \Temporal\Worker\Transport\Goridge::create()->call( - * 'temporal.UpdateAPIKey', - * $newApiKey, - * ); + * ``` + * $result = \Temporal\Worker\Transport\Goridge::create()->call( + * 'temporal.UpdateAPIKey', + * $newApiKey, + * ); + * ``` * * @link https://docs.temporal.io/cloud/api-keys * @since SDK 2.12.0 diff --git a/src/Worker/Transport/Command/RequestInterface.php b/src/Worker/Transport/Command/RequestInterface.php index d176a14a..8263dccd 100644 --- a/src/Worker/Transport/Command/RequestInterface.php +++ b/src/Worker/Transport/Command/RequestInterface.php @@ -35,7 +35,6 @@ public function getPayloads(): ValuesInterface; /** * Optional failure. - * */ public function getFailure(): ?\Throwable; diff --git a/src/Worker/WorkerFactoryInterface.php b/src/Worker/WorkerFactoryInterface.php index c094d8cc..a171094b 100644 --- a/src/Worker/WorkerFactoryInterface.php +++ b/src/Worker/WorkerFactoryInterface.php @@ -32,7 +32,6 @@ interface WorkerFactoryInterface /** * Create a new Temporal Worker with the name of the task queue and register in worker. - * */ public function newWorker( string $taskQueue = self::DEFAULT_TASK_QUEUE, diff --git a/src/Worker/WorkerInterface.php b/src/Worker/WorkerInterface.php index 90612ae5..893cff75 100644 --- a/src/Worker/WorkerInterface.php +++ b/src/Worker/WorkerInterface.php @@ -23,7 +23,6 @@ interface WorkerInterface extends Identifiable { /** * Returns processing options associated with specific worker task queue. - * */ public function getOptions(): WorkerOptions; diff --git a/src/Worker/WorkerOptions.php b/src/Worker/WorkerOptions.php index 72cac3b8..c8aafa5a 100644 --- a/src/Worker/WorkerOptions.php +++ b/src/Worker/WorkerOptions.php @@ -622,7 +622,6 @@ public function withEnableSessionWorker(bool $enable = true): self * * For now, if user doesn't specify one, a new uuid will be used as the * resourceID. - * */ #[Pure] public function withSessionResourceId(?string $identifier): self diff --git a/src/Workflow/CancellationScopeInterface.php b/src/Workflow/CancellationScopeInterface.php index 5fdd5908..8a819c2a 100644 --- a/src/Workflow/CancellationScopeInterface.php +++ b/src/Workflow/CancellationScopeInterface.php @@ -22,13 +22,11 @@ interface CancellationScopeInterface extends PromiseInterface { /** * Detached scopes can continue working even if parent scope was cancelled. - * */ public function isDetached(): bool; /** * Returns true if cancel request was sent to scope. - * */ public function isCancelled(): bool; @@ -45,7 +43,6 @@ public function onCancel(callable $then): self; * * Once a promise is settled (either fulfilled or rejected), calling `cancel()` on * a promise has no effect. - * */ public function cancel(): void; } diff --git a/src/Workflow/WorkflowContextInterface.php b/src/Workflow/WorkflowContextInterface.php index 54a4ff82..f2a5e915 100644 --- a/src/Workflow/WorkflowContextInterface.php +++ b/src/Workflow/WorkflowContextInterface.php @@ -31,7 +31,6 @@ interface WorkflowContextInterface extends EnvironmentInterface * Returns information about current workflow execution. * * @see Workflow::getInfo() - * */ public function getInfo(): WorkflowInfo; @@ -39,7 +38,6 @@ public function getInfo(): WorkflowInfo; * Returns workflow execution input arguments. * * @see Workflow::getInput() - * */ public function getInput(): ValuesInterface; @@ -85,7 +83,6 @@ public function registerUpdate(string $name, callable $handler, ?callable $valid * Exchanges data between worker and host process. * * @internal This is an internal method - * */ public function request(RequestInterface $request, bool $cancellable = true): PromiseInterface; @@ -93,7 +90,6 @@ public function request(RequestInterface $request, bool $cancellable = true): Pr * Updates the behavior of an existing workflow to resolve inconsistency errors during replay. * * @see Workflow::getVersion() - * */ public function getVersion(string $changeId, int $minSupported, int $maxSupported): PromiseInterface; @@ -110,13 +106,11 @@ public function sideEffect(callable $context): PromiseInterface; /** * @internal This is an internal method - * */ public function complete(?array $result = null, ?\Throwable $failure = null): PromiseInterface; /** * @internal This is an internal method - * */ public function panic(?\Throwable $failure = null): PromiseInterface; @@ -134,7 +128,6 @@ public function timer($interval): PromiseInterface; * Completes the current workflow execution atomically and starts a new execution with the same Workflow Id. * * @see Workflow::continueAsNew() - * */ public function continueAsNew( string $type, @@ -159,7 +152,6 @@ public function newContinueAsNewStub(string $class, ?ContinueAsNewOptions $optio * @see Workflow::executeChildWorkflow() * * @param Type|string|\ReflectionType|\ReflectionClass|null $returnType - * */ public function executeChildWorkflow( string $type, @@ -187,8 +179,6 @@ public function newChildWorkflowStub( * Creates a proxy for a workflow by name to execute as a child workflow. * * @see Workflow::newUntypedChildWorkflowStub() - * - * */ public function newUntypedChildWorkflowStub( string $type, @@ -212,7 +202,6 @@ public function newExternalWorkflowStub(string $class, WorkflowExecution $execut * workflow. * * @see Workflow::newUntypedExternalWorkflowStub() - * */ public function newUntypedExternalWorkflowStub(WorkflowExecution $execution): ExternalWorkflowStubInterface; @@ -254,8 +243,6 @@ public function newActivityStub( * that allows to call an activities with the passed options. * * @see Workflow::newUntypedActivityStub() - * - * */ public function newUntypedActivityStub( ?ActivityOptionsInterface $options = null, @@ -288,7 +275,6 @@ public function awaitWithTimeout($interval, callable|Mutex|PromiseInterface ...$ * Returns a complete trace of the last calls (for debugging). * * @see Workflow::getStackTrace() - * */ public function getStackTrace(): string; diff --git a/src/Workflow/WorkflowInfo.php b/src/Workflow/WorkflowInfo.php index 202df533..305dcb1e 100644 --- a/src/Workflow/WorkflowInfo.php +++ b/src/Workflow/WorkflowInfo.php @@ -93,7 +93,6 @@ final class WorkflowInfo /** * @see CronSchedule::$interval for more info about cron format. - * */ #[Marshal(name: 'CronSchedule', type: NullableType::class, of: CronType::class)] public ?string $cronSchedule = null; diff --git a/src/Workflow/WorkflowRunInterface.php b/src/Workflow/WorkflowRunInterface.php index 87003f8c..96e282b1 100644 --- a/src/Workflow/WorkflowRunInterface.php +++ b/src/Workflow/WorkflowRunInterface.php @@ -22,7 +22,6 @@ interface WorkflowRunInterface { /** * Returns attached workflow execution. - * */ public function getExecution(): WorkflowExecution;