From 530308a0cdc39a675fe1f08c0fe0b6ebf136590b Mon Sep 17 00:00:00 2001 From: Aleksei Gagarin Date: Mon, 13 Nov 2023 22:05:08 +0400 Subject: [PATCH] Rename `WorkflowInboundInterceptor` to `WorkflowInboundCallsInterceptor` (#371) --- ....php => WorkflowInboundCallsInterceptorTrait.php} | 12 ++++++------ ...eptor.php => WorkflowInboundCallsInterceptor.php} | 6 +++--- .../Instantiator/WorkflowInstantiator.php | 4 ++-- src/Internal/Declaration/WorkflowInstance.php | 8 ++++---- src/Internal/Transport/Router/StartWorkflow.php | 6 +++--- src/Internal/Workflow/Process/Process.php | 6 +++--- src/Internal/Workflow/WorkflowContext.php | 4 ++-- src/Workflow.php | 2 +- tests/Fixtures/PipelineProvider.php | 4 ++-- tests/Fixtures/src/Interceptor/HeaderChanger.php | 8 ++++---- .../src/Interceptor/InterceptorCallsCounter.php | 4 ++-- 11 files changed, 32 insertions(+), 32 deletions(-) rename src/Interceptor/Trait/{WorkflowInboundInterceptorTrait.php => WorkflowInboundCallsInterceptorTrait.php} (71%) rename src/Interceptor/{WorkflowInboundInterceptor.php => WorkflowInboundCallsInterceptor.php} (82%) diff --git a/src/Interceptor/Trait/WorkflowInboundInterceptorTrait.php b/src/Interceptor/Trait/WorkflowInboundCallsInterceptorTrait.php similarity index 71% rename from src/Interceptor/Trait/WorkflowInboundInterceptorTrait.php rename to src/Interceptor/Trait/WorkflowInboundCallsInterceptorTrait.php index 67994605..06a775e5 100644 --- a/src/Interceptor/Trait/WorkflowInboundInterceptorTrait.php +++ b/src/Interceptor/Trait/WorkflowInboundCallsInterceptorTrait.php @@ -14,15 +14,15 @@ use Temporal\Interceptor\WorkflowInbound\QueryInput; use Temporal\Interceptor\WorkflowInbound\SignalInput; use Temporal\Interceptor\WorkflowInbound\WorkflowInput; -use Temporal\Interceptor\WorkflowInboundInterceptor; +use Temporal\Interceptor\WorkflowInboundCallsInterceptor; /** - * Implements {@see WorkflowInboundInterceptor} + * Implements {@see WorkflowInboundCallsInterceptor} */ -trait WorkflowInboundInterceptorTrait +trait WorkflowInboundCallsInterceptorTrait { /** - * @see WorkflowInboundInterceptor::execute() + * @see WorkflowInboundCallsInterceptor::execute() */ public function execute(WorkflowInput $input, callable $next): void { @@ -30,7 +30,7 @@ public function execute(WorkflowInput $input, callable $next): void } /** - * @see WorkflowInboundInterceptor::handleSignal() + * @see WorkflowInboundCallsInterceptor::handleSignal() */ public function handleSignal(SignalInput $input, callable $next): void { @@ -38,7 +38,7 @@ public function handleSignal(SignalInput $input, callable $next): void } /** - * @see WorkflowInboundInterceptor::handleQuery() + * @see WorkflowInboundCallsInterceptor::handleQuery() */ public function handleQuery(QueryInput $input, callable $next): mixed { diff --git a/src/Interceptor/WorkflowInboundInterceptor.php b/src/Interceptor/WorkflowInboundCallsInterceptor.php similarity index 82% rename from src/Interceptor/WorkflowInboundInterceptor.php rename to src/Interceptor/WorkflowInboundCallsInterceptor.php index b48845fb..148a3b02 100644 --- a/src/Interceptor/WorkflowInboundInterceptor.php +++ b/src/Interceptor/WorkflowInboundCallsInterceptor.php @@ -11,19 +11,19 @@ namespace Temporal\Interceptor; -use Temporal\Interceptor\Trait\WorkflowInboundInterceptorTrait; +use Temporal\Interceptor\Trait\WorkflowInboundCallsInterceptorTrait; use Temporal\Interceptor\WorkflowInbound\QueryInput; use Temporal\Interceptor\WorkflowInbound\SignalInput; use Temporal\Interceptor\WorkflowInbound\WorkflowInput; use Temporal\Internal\Interceptor\Interceptor; /** - * It's recommended to use {@see WorkflowInboundInterceptorTrait} when implementing this interface because + * It's recommended to use {@see WorkflowInboundCallsInterceptorTrait} when implementing this interface because * the interface might be extended in the future. The trait will provide forward compatibility. * * @psalm-immutable */ -interface WorkflowInboundInterceptor extends Interceptor +interface WorkflowInboundCallsInterceptor extends Interceptor { /** * @param WorkflowInput $input diff --git a/src/Internal/Declaration/Instantiator/WorkflowInstantiator.php b/src/Internal/Declaration/Instantiator/WorkflowInstantiator.php index 4dd596ae..fcb56eb4 100644 --- a/src/Internal/Declaration/Instantiator/WorkflowInstantiator.php +++ b/src/Internal/Declaration/Instantiator/WorkflowInstantiator.php @@ -12,7 +12,7 @@ namespace Temporal\Internal\Declaration\Instantiator; use Temporal\Exception\InstantiationException; -use Temporal\Interceptor\WorkflowInboundInterceptor; +use Temporal\Interceptor\WorkflowInboundCallsInterceptor; use Temporal\Internal\Declaration\Prototype\PrototypeInterface; use Temporal\Internal\Declaration\Prototype\WorkflowPrototype; use Temporal\Internal\Declaration\WorkflowInstance; @@ -37,7 +37,7 @@ public function instantiate(PrototypeInterface $prototype): WorkflowInstance return new WorkflowInstance( $prototype, $this->getInstance($prototype), - $this->interceptorProvider->getPipeline(WorkflowInboundInterceptor::class), + $this->interceptorProvider->getPipeline(WorkflowInboundCallsInterceptor::class), ); } diff --git a/src/Internal/Declaration/WorkflowInstance.php b/src/Internal/Declaration/WorkflowInstance.php index 20733e8b..d13e4c43 100644 --- a/src/Internal/Declaration/WorkflowInstance.php +++ b/src/Internal/Declaration/WorkflowInstance.php @@ -13,7 +13,7 @@ use Temporal\DataConverter\ValuesInterface; use Temporal\Interceptor\WorkflowInbound\QueryInput; -use Temporal\Interceptor\WorkflowInboundInterceptor; +use Temporal\Interceptor\WorkflowInboundCallsInterceptor; use Temporal\Internal\Declaration\Prototype\WorkflowPrototype; use Temporal\Internal\Declaration\WorkflowInstance\SignalQueue; use Temporal\Internal\Interceptor; @@ -46,7 +46,7 @@ final class WorkflowInstance extends Instance implements WorkflowInstanceInterfa /** * @param WorkflowPrototype $prototype * @param object $context - * @param Interceptor\Pipeline $pipeline + * @param Interceptor\Pipeline $pipeline */ public function __construct( WorkflowPrototype $prototype, @@ -68,7 +68,7 @@ public function __construct( function (QueryInput $input) use ($fn) { return ($this->queryExecutor)($input, $fn); }, - /** @see WorkflowInboundInterceptor::handleQuery() */ + /** @see WorkflowInboundCallsInterceptor::handleQuery() */ 'handleQuery', )); } @@ -127,7 +127,7 @@ public function addQueryHandler(string $name, callable $handler): void function (QueryInput $input) use ($fn) { return ($this->queryExecutor)($input, $fn); }, - /** @see WorkflowInboundInterceptor::handleQuery() */ + /** @see WorkflowInboundCallsInterceptor::handleQuery() */ 'handleQuery', )); } diff --git a/src/Internal/Transport/Router/StartWorkflow.php b/src/Internal/Transport/Router/StartWorkflow.php index eb309920..bbb166b2 100644 --- a/src/Internal/Transport/Router/StartWorkflow.php +++ b/src/Internal/Transport/Router/StartWorkflow.php @@ -14,7 +14,7 @@ use React\Promise\Deferred; use Temporal\DataConverter\EncodedValues; use Temporal\Interceptor\WorkflowInbound\WorkflowInput; -use Temporal\Interceptor\WorkflowInboundInterceptor; +use Temporal\Interceptor\WorkflowInboundCallsInterceptor; use Temporal\Internal\Declaration\Instantiator\WorkflowInstantiator; use Temporal\Internal\Declaration\Prototype\WorkflowPrototype; use Temporal\Internal\ServiceContainer; @@ -96,10 +96,10 @@ public function handle(ServerRequestInterface $request, array $headers, Deferred // Run workflow handler in an interceptor pipeline $this->services->interceptorProvider - ->getPipeline(WorkflowInboundInterceptor::class) + ->getPipeline(WorkflowInboundCallsInterceptor::class) ->with( $starter, - /** @see WorkflowInboundInterceptor::execute() */ + /** @see WorkflowInboundCallsInterceptor::execute() */ 'execute', )( new WorkflowInput($context->getInfo(), $context->getInput(), $context->getHeader()), diff --git a/src/Internal/Workflow/Process/Process.php b/src/Internal/Workflow/Process/Process.php index 2d5cb2e5..78337b09 100644 --- a/src/Internal/Workflow/Process/Process.php +++ b/src/Internal/Workflow/Process/Process.php @@ -16,7 +16,7 @@ use Temporal\Exception\DestructMemorizedInstanceException; use Temporal\Interceptor\WorkflowInbound\QueryInput; use Temporal\Interceptor\WorkflowInbound\SignalInput; -use Temporal\Interceptor\WorkflowInboundInterceptor; +use Temporal\Interceptor\WorkflowInboundCallsInterceptor; use Temporal\Internal\Declaration\WorkflowInstance; use Temporal\Internal\Declaration\WorkflowInstanceInterface; use Temporal\Internal\ServiceContainer; @@ -45,7 +45,7 @@ public function __construct( ) { parent::__construct($services, $ctx); - $inboundPipeline = $services->interceptorProvider->getPipeline(WorkflowInboundInterceptor::class); + $inboundPipeline = $services->interceptorProvider->getPipeline(WorkflowInboundCallsInterceptor::class); $wfInstance = $this->getWorkflowInstance(); \assert($wfInstance instanceof WorkflowInstance); @@ -92,7 +92,7 @@ function (?\Throwable $error): void { $input->arguments ); }, - /** @see WorkflowInboundInterceptor::handleSignal() */ + /** @see WorkflowInboundCallsInterceptor::handleSignal() */ 'handleSignal', )(new SignalInput( $name, diff --git a/src/Internal/Workflow/WorkflowContext.php b/src/Internal/Workflow/WorkflowContext.php index cac298e2..a0b66d8e 100644 --- a/src/Internal/Workflow/WorkflowContext.php +++ b/src/Internal/Workflow/WorkflowContext.php @@ -359,7 +359,7 @@ public function executeChildWorkflow( string $type, array $args = [], ChildWorkflowOptions $options = null, - $returnType = null, + mixed $returnType = null, ): PromiseInterface { return $this->callsInterceptor->with( fn(ExecuteChildWorkflowInput $input): PromiseInterface => $this @@ -467,7 +467,7 @@ public function newUntypedActivityStub( public function newActivityStub( string $class, ActivityOptionsInterface $options = null, - ): object { + ): ActivityProxy { $activities = $this->services->activitiesReader->fromClass($class); if (isset($activities[0]) && $activities[0]->isLocalActivity() && !$options instanceof LocalActivityOptions) { diff --git a/src/Workflow.php b/src/Workflow.php index a1d397e9..c2e1428b 100644 --- a/src/Workflow.php +++ b/src/Workflow.php @@ -580,7 +580,7 @@ public static function executeChildWorkflow( string $type, array $args = [], ChildWorkflowOptions $options = null, - $returnType = null, + mixed $returnType = null, ): PromiseInterface { return self::getCurrentContext()->executeChildWorkflow($type, $args, $options, $returnType); } diff --git a/tests/Fixtures/PipelineProvider.php b/tests/Fixtures/PipelineProvider.php index ec928404..27dd7442 100644 --- a/tests/Fixtures/PipelineProvider.php +++ b/tests/Fixtures/PipelineProvider.php @@ -13,7 +13,7 @@ use Temporal\Interceptor\ActivityInboundInterceptor; use Temporal\Interceptor\WorkflowClientCallsInterceptor; -use Temporal\Interceptor\WorkflowInboundInterceptor; +use Temporal\Interceptor\WorkflowInboundCallsInterceptor; use Temporal\Interceptor\WorkflowOutboundRequestInterceptor; use Temporal\Internal\Interceptor\Interceptor; use Temporal\Internal\Interceptor\Pipeline; @@ -26,7 +26,7 @@ final class PipelineProvider implements \Temporal\Interceptor\PipelineProvider * @param array, array>> $classes */ private array $classes = [ - WorkflowInboundInterceptor::class => [], + WorkflowInboundCallsInterceptor::class => [], WorkflowOutboundRequestInterceptor::class => [], ActivityInboundInterceptor::class => [], WorkflowClientCallsInterceptor::class => [], diff --git a/tests/Fixtures/src/Interceptor/HeaderChanger.php b/tests/Fixtures/src/Interceptor/HeaderChanger.php index 4d96707c..da3c17ac 100644 --- a/tests/Fixtures/src/Interceptor/HeaderChanger.php +++ b/tests/Fixtures/src/Interceptor/HeaderChanger.php @@ -15,11 +15,11 @@ use RuntimeException; use Temporal\Interceptor\Header; use Temporal\Interceptor\Trait\WorkflowClientCallsInterceptorTrait; -use Temporal\Interceptor\Trait\WorkflowInboundInterceptorTrait; +use Temporal\Interceptor\Trait\WorkflowInboundCallsInterceptorTrait; use Temporal\Interceptor\WorkflowClient\StartInput; use Temporal\Interceptor\WorkflowClientCallsInterceptor; use Temporal\Interceptor\WorkflowInbound\WorkflowInput; -use Temporal\Interceptor\WorkflowInboundInterceptor; +use Temporal\Interceptor\WorkflowInboundCallsInterceptor; use Temporal\Interceptor\WorkflowOutboundRequestInterceptor; use Temporal\Internal\Transport\Request\ExecuteActivity; use Temporal\Tests\Workflow\Header\ChildedHeaderWorkflow; @@ -35,10 +35,10 @@ */ final class HeaderChanger implements WorkflowOutboundRequestInterceptor, - WorkflowInboundInterceptor, + WorkflowInboundCallsInterceptor, WorkflowClientCallsInterceptor { - use WorkflowInboundInterceptorTrait; + use WorkflowInboundCallsInterceptorTrait; use WorkflowClientCallsInterceptorTrait; private function processInput(StartInput $input): StartInput diff --git a/tests/Fixtures/src/Interceptor/InterceptorCallsCounter.php b/tests/Fixtures/src/Interceptor/InterceptorCallsCounter.php index e76ed749..4cefffb8 100644 --- a/tests/Fixtures/src/Interceptor/InterceptorCallsCounter.php +++ b/tests/Fixtures/src/Interceptor/InterceptorCallsCounter.php @@ -25,7 +25,7 @@ use Temporal\Interceptor\WorkflowInbound\QueryInput; use Temporal\Interceptor\WorkflowInbound\SignalInput; use Temporal\Interceptor\WorkflowInbound\WorkflowInput; -use Temporal\Interceptor\WorkflowInboundInterceptor; +use Temporal\Interceptor\WorkflowInboundCallsInterceptor; use Temporal\Interceptor\WorkflowOutboundRequestInterceptor; use Temporal\Worker\Transport\Command\RequestInterface; use Temporal\Workflow; @@ -41,7 +41,7 @@ final class InterceptorCallsCounter implements WorkflowOutboundRequestInterceptor, ActivityInboundInterceptor, - WorkflowInboundInterceptor, + WorkflowInboundCallsInterceptor, WorkflowClientCallsInterceptor { private function increment(HeaderInterface $header, string $key): HeaderInterface