Skip to content

Commit

Permalink
Rename WorkflowInboundInterceptor to `WorkflowInboundCallsIntercept…
Browse files Browse the repository at this point in the history
…or` (#371)
  • Loading branch information
roxblnfk authored Nov 13, 2023
1 parent 775cc98 commit 530308a
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@
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
{
$next($input);
}

/**
* @see WorkflowInboundInterceptor::handleSignal()
* @see WorkflowInboundCallsInterceptor::handleSignal()
*/
public function handleSignal(SignalInput $input, callable $next): void
{
$next($input);
}

/**
* @see WorkflowInboundInterceptor::handleQuery()
* @see WorkflowInboundCallsInterceptor::handleQuery()
*/
public function handleQuery(QueryInput $input, callable $next): mixed
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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),
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Internal/Declaration/WorkflowInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -46,7 +46,7 @@ final class WorkflowInstance extends Instance implements WorkflowInstanceInterfa
/**
* @param WorkflowPrototype $prototype
* @param object $context
* @param Interceptor\Pipeline<WorkflowInboundInterceptor, mixed> $pipeline
* @param Interceptor\Pipeline<WorkflowInboundCallsInterceptor, mixed> $pipeline
*/
public function __construct(
WorkflowPrototype $prototype,
Expand All @@ -68,7 +68,7 @@ public function __construct(
function (QueryInput $input) use ($fn) {
return ($this->queryExecutor)($input, $fn);
},
/** @see WorkflowInboundInterceptor::handleQuery() */
/** @see WorkflowInboundCallsInterceptor::handleQuery() */
'handleQuery',
));
}
Expand Down Expand Up @@ -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',
));
}
Expand Down
6 changes: 3 additions & 3 deletions src/Internal/Transport/Router/StartWorkflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()),
Expand Down
6 changes: 3 additions & 3 deletions src/Internal/Workflow/Process/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -92,7 +92,7 @@ function (?\Throwable $error): void {
$input->arguments
);
},
/** @see WorkflowInboundInterceptor::handleSignal() */
/** @see WorkflowInboundCallsInterceptor::handleSignal() */
'handleSignal',
)(new SignalInput(
$name,
Expand Down
4 changes: 2 additions & 2 deletions src/Internal/Workflow/WorkflowContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/PipelineProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +26,7 @@ final class PipelineProvider implements \Temporal\Interceptor\PipelineProvider
* @param array<class-string<Type>, array<class-string<Type>>> $classes
*/
private array $classes = [
WorkflowInboundInterceptor::class => [],
WorkflowInboundCallsInterceptor::class => [],
WorkflowOutboundRequestInterceptor::class => [],
ActivityInboundInterceptor::class => [],
WorkflowClientCallsInterceptor::class => [],
Expand Down
8 changes: 4 additions & 4 deletions tests/Fixtures/src/Interceptor/HeaderChanger.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -35,10 +35,10 @@
*/
final class HeaderChanger implements
WorkflowOutboundRequestInterceptor,
WorkflowInboundInterceptor,
WorkflowInboundCallsInterceptor,
WorkflowClientCallsInterceptor
{
use WorkflowInboundInterceptorTrait;
use WorkflowInboundCallsInterceptorTrait;
use WorkflowClientCallsInterceptorTrait;

private function processInput(StartInput $input): StartInput
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/src/Interceptor/InterceptorCallsCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -41,7 +41,7 @@
final class InterceptorCallsCounter implements
WorkflowOutboundRequestInterceptor,
ActivityInboundInterceptor,
WorkflowInboundInterceptor,
WorkflowInboundCallsInterceptor,
WorkflowClientCallsInterceptor
{
private function increment(HeaderInterface $header, string $key): HeaderInterface
Expand Down

0 comments on commit 530308a

Please sign in to comment.