Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 74 additions & 46 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
<code><![CDATA[$workflowType]]></code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Client/Schedule/ScheduleHandle.php">
<TooManyTemplateParams>
<code><![CDATA[$response->getStartTime()]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Client/Schedule/ScheduleOptions.php">
<DeprecatedProperty>
<code><![CDATA[$this->namespace]]></code>
Expand All @@ -106,8 +111,15 @@
<file src="src/Client/ScheduleClient.php">
<DeprecatedProperty>
<code><![CDATA[$options->namespace]]></code>
<code><![CDATA[$options->namespace]]></code>
</DeprecatedProperty>
<TooManyTemplateParams>
<code><![CDATA[$response->getSchedules()]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Client/Workflow/WorkflowExecutionHistory.php">
<TooManyTemplateParams>
<code><![CDATA[$history->getEvents()]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Client/WorkflowClient.php">
<ArgumentTypeCoercion>
Expand Down Expand Up @@ -141,6 +153,9 @@
<code><![CDATA[\sprintf]]></code>
<code><![CDATA[\sprintf]]></code>
</RedundantFunctionCall>
<TooManyTemplateParams>
<code><![CDATA[$response->getExecutions()]]></code>
</TooManyTemplateParams>
<TypeDoesNotContainType>
<code><![CDATA[$signal === '']]></code>
</TypeDoesNotContainType>
Expand All @@ -153,12 +168,14 @@
<file src="src/Client/WorkflowOptions.php">
<ImpureMethodCall>
<code><![CDATA[$this->typedSearchAttributes]]></code>
<code><![CDATA[fromValues]]></code>
<code><![CDATA[setFields]]></code>
<code><![CDATA[setIndexedFields]]></code>
<code><![CDATA[setIndexedFields]]></code>
<code><![CDATA[setSerializationContext]]></code>
<code><![CDATA[toPayload]]></code>
<code><![CDATA[toPayload]]></code>
<code><![CDATA[toPayload]]></code>
<code><![CDATA[toPayloadArray]]></code>
</ImpureMethodCall>
<UnnecessaryVarAnnotation>
<code><![CDATA[SearchAttributeKey]]></code>
Expand Down Expand Up @@ -245,6 +262,12 @@
<code><![CDATA[$value]]></code>
</InvalidArgument>
</file>
<file src="src/DataConverter/EncodedValues.php">
<TooManyTemplateParams>
<code><![CDATA[$payloads->getPayloads()]]></code>
<code><![CDATA[$payloads->getPayloads()]]></code>
</TooManyTemplateParams>
</file>
<file src="src/DataConverter/JsonConverter.php">
<DeprecatedClass>
<code><![CDATA[new AnnotationReader()]]></code>
Expand All @@ -255,10 +278,18 @@
<code><![CDATA[getID]]></code>
</PossiblyNullReference>
</file>
<file src="src/Exception/Client/MultyOperation/OperationStatus.php">
<InvalidArgument>
<code><![CDATA[$message->getDetails()]]></code>
</InvalidArgument>
<TooManyTemplateParams>
<code><![CDATA[$message->getDetails()]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Exception/Client/ServiceClientException.php">
<ImplementedReturnTypeMismatch>
<code><![CDATA[RepeatedField]]></code>
</ImplementedReturnTypeMismatch>
<TooManyTemplateParams>
<code><![CDATA[$this->status->getDetails()]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Exception/Client/WorkflowException.php">
<UnsafeInstantiation>
Expand Down Expand Up @@ -385,6 +416,10 @@
<code><![CDATA[getStartWorkflow]]></code>
<code><![CDATA[getUpdateWorkflow]]></code>
</PossiblyNullReference>
<TooManyTemplateParams>
<code><![CDATA[$failure->getStatuses()]]></code>
<code><![CDATA[$response->getResponses()]]></code>
</TooManyTemplateParams>
<UndefinedInterfaceMethod>
<code><![CDATA[toHeader]]></code>
</UndefinedInterfaceMethod>
Expand Down Expand Up @@ -422,6 +457,9 @@
<code><![CDATA[hasResult]]></code>
<code><![CDATA[toProtoWorkflowExecution]]></code>
</PossiblyNullReference>
<TooManyTemplateParams>
<code><![CDATA[$history->getEvents()]]></code>
</TooManyTemplateParams>
<UndefinedInterfaceMethod>
<code><![CDATA[toHeader]]></code>
</UndefinedInterfaceMethod>
Expand Down Expand Up @@ -566,18 +604,6 @@
<PossiblyNullArgument>
<code><![CDATA[$dto->action]]></code>
</PossiblyNullArgument>
<RedundantCondition>
<code><![CDATA[$action->header?->setDataConverter($this->converter)]]></code>
<code><![CDATA[$action->input?->setDataConverter($this->converter)]]></code>
<code><![CDATA[$action->memo?->setDataConverter($this->converter)]]></code>
<code><![CDATA[$action->searchAttributes?->setDataConverter($this->converter)]]></code>
</RedundantCondition>
<TypeDoesNotContainNull>
<code><![CDATA[$action->header]]></code>
<code><![CDATA[$action->input]]></code>
<code><![CDATA[$action->memo]]></code>
<code><![CDATA[$action->searchAttributes]]></code>
</TypeDoesNotContainNull>
<UndefinedInterfaceMethod>
<code><![CDATA[setDataConverter]]></code>
</UndefinedInterfaceMethod>
Expand All @@ -603,7 +629,6 @@
<code><![CDATA[(int) $message->getStateTransitionCount()]]></code>
</ArgumentTypeCoercion>
<DeprecatedMethod>
<code><![CDATA[getBinaryChecksum]]></code>
<code><![CDATA[getMostRecentWorkerVersionStamp]]></code>
</DeprecatedMethod>
<DocblockTypeContradiction>
Expand All @@ -616,6 +641,9 @@
<RedundantConditionGivenDocblockType>
<code><![CDATA[parse]]></code>
</RedundantConditionGivenDocblockType>
<TooManyTemplateParams>
<code><![CDATA[$getAutoResetPoints->getPoints()]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Internal/Marshaller/Mapper/AttributeMapper.php">
<MissingClosureParamType>
Expand Down Expand Up @@ -698,6 +726,9 @@
<code><![CDATA[$metadata->getDetails()]]></code>
<code><![CDATA[$metadata->getSummary()]]></code>
</PossiblyNullArgument>
<TooManyTemplateParams>
<code><![CDATA[$input->getPayloads()]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Internal/Marshaller/Type/ArrayType.php">
<MoreSpecificImplementedParamType>
Expand Down Expand Up @@ -921,10 +952,6 @@
</ArgumentTypeCoercion>
</file>
<file src="src/Internal/Transport/Router/StartWorkflow.php">
<PossiblyFalseArgument>
<code><![CDATA[\json_encode($param)]]></code>
<code><![CDATA[\json_encode($param)]]></code>
</PossiblyFalseArgument>
<UnnecessaryVarAnnotation>
<code><![CDATA[Input]]></code>
</UnnecessaryVarAnnotation>
Expand Down Expand Up @@ -971,16 +998,16 @@
<LessSpecificReturnStatement>
<code><![CDATA[$this->execution->promise()->then(
function (WorkflowExecution $execution) use ($name, $args) {
$request = new SignalExternalWorkflow(
$this->getOptions()->namespace,
$execution->getID(),
null,
$name,
EncodedValues::fromValues($args),
true,
return $this->request(
new SignalExternalWorkflow(
$this->resolveNamespace(),
$execution->getID(),
null,
$name,
EncodedValues::fromValues($args),
true,
),
);

return $this->request($request);
},
)]]></code>
<code><![CDATA[$this->start(...$args)->then(fn() => $this->getResult($returnType))]]></code>
Expand Down Expand Up @@ -1049,6 +1076,7 @@
<code><![CDATA[$scope]]></code>
</PropertyNotSetInConstructor>
<UnsupportedPropertyReferenceUsage>
<code><![CDATA[$ctx->childWorkflowSequence = &$context->childWorkflowSequence]]></code>
<code><![CDATA[$ctx->currentDetails = &$context->currentDetails]]></code>
<code><![CDATA[$ctx->trace = &$context->trace]]></code>
</UnsupportedPropertyReferenceUsage>
Expand Down Expand Up @@ -1096,6 +1124,7 @@
</NullableReturnStatement>
<UnsupportedPropertyReferenceUsage>
<code><![CDATA[$clone->awaits = &$this->awaits]]></code>
<code><![CDATA[$clone->childWorkflowSequence = &$this->childWorkflowSequence]]></code>
<code><![CDATA[$clone->trace = &$this->trace]]></code>
</UnsupportedPropertyReferenceUsage>
</file>
Expand Down Expand Up @@ -1182,19 +1211,16 @@
</PossiblyNullArgument>
</file>
<file src="src/Worker/Transport/Codec/ProtoCodec.php">
<LessSpecificReturnStatement>
<code><![CDATA[$frame->serializeToString()]]></code>
</LessSpecificReturnStatement>
<MoreSpecificReturnType>
<code><![CDATA[string]]></code>
</MoreSpecificReturnType>
<PossiblyInvalidArgument>
<code><![CDATA[$e->getCode()]]></code>
<code><![CDATA[$e->getCode()]]></code>
</PossiblyInvalidArgument>
<TooManyArguments>
<code><![CDATA[decode]]></code>
</TooManyArguments>
<TooManyTemplateParams>
<code><![CDATA[$frame->getMessages()]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Worker/Transport/Codec/ProtoCodec/Decoder.php">
<ArgumentTypeCoercion>
Expand Down Expand Up @@ -1421,6 +1447,12 @@
</PossiblyNullReference>
</file>
<file src="testing/src/Replay/WorkflowReplayer.php">
<InvalidArgument>
<code><![CDATA[0]]></code>
</InvalidArgument>
<TooManyTemplateParams>
<code><![CDATA[$history->getEvents()]]></code>
</TooManyTemplateParams>
<UndefinedMethod>
<code><![CDATA[getWorkflowType]]></code>
</UndefinedMethod>
Expand Down Expand Up @@ -1482,24 +1514,20 @@
</RiskyTruthyFalsyComparison>
</file>
<file src="testing/src/Transcript/WireFrameDecoder.php">
<InvalidArgument>
<code><![CDATA[EncodingKeys::METADATA_ENCODING_KEY]]></code>
</InvalidArgument>
<PossiblyNullArgument>
<code><![CDATA[$message->getHeader()]]></code>
<code><![CDATA[$message->getPayloads()]]></code>
</PossiblyNullArgument>
<TooManyTemplateParams>
<code><![CDATA[$fields]]></code>
<code><![CDATA[$meta]]></code>
<code><![CDATA[$payloads->getPayloads()]]></code>
<code><![CDATA[$proto->getMessages()]]></code>
</TooManyTemplateParams>
</file>
<file src="testing/src/Transcript/WorkflowHistoryDumper.php">
<InvalidOperand>
<code><![CDATA[$eventTime->getSeconds() + \round($eventTime->getNanos() / 1_000_000_000, 6)]]></code>
<code><![CDATA[($sec - $startSec) * 1000]]></code>
</InvalidOperand>
<PossiblyInvalidOperand>
<code><![CDATA[$eventTime->getSeconds()]]></code>
</PossiblyInvalidOperand>
</file>
<file src="testing/src/WorkerMock.php">
<DeprecatedMethod>
<code><![CDATA[registerActivityImplementations]]></code>
Expand Down
4 changes: 4 additions & 0 deletions src/Client/ActivityCompletionClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Temporal\Client;

use Temporal\DataConverter\ActivitySerializationContext;

/**
* Used to complete asynchronously activities that called {@link
* ActivityContext->doNotCompleteOnReturn()}.
Expand All @@ -19,6 +21,8 @@
*/
interface ActivityCompletionClientInterface
{
public function withContext(ActivitySerializationContext $context): self;

/**
* @param mixed $result
*/
Expand Down
17 changes: 15 additions & 2 deletions src/Client/Schedule/ScheduleHandle.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

declare(strict_types=1);
Expand All @@ -17,12 +17,14 @@
use Temporal\Client\ClientOptions;
use Temporal\Client\Common\ClientContextTrait;
use Temporal\Client\GRPC\ServiceClientInterface;
use Temporal\Client\Schedule\Action\StartWorkflowAction;
use Temporal\Client\Schedule\Info\ScheduleDescription;
use Temporal\Client\Schedule\Policy\ScheduleOverlapPolicy;
use Temporal\Client\Schedule\Update\ScheduleUpdate;
use Temporal\Client\Schedule\Update\ScheduleUpdateInput;
use Temporal\Common\Uuid;
use Temporal\DataConverter\DataConverterInterface;
use Temporal\DataConverter\WorkflowSerializationContext;
use Temporal\Exception\InvalidArgumentException;
use Temporal\Internal\Mapper\ScheduleMapper;
use Temporal\Internal\Marshaller\MarshallerInterface;
Expand Down Expand Up @@ -119,7 +121,7 @@
}

$mapper = new ScheduleMapper($this->converter, $this->marshaller);
$scheduleMessage = $mapper->toMessage($schedule);
$scheduleMessage = $mapper->toMessage($schedule, $this->namespace);
$request->setSchedule($scheduleMessage);


Expand All @@ -139,7 +141,18 @@
$values = $this->protoConverter->convert($response);
$dto = new ScheduleDescription();

return $this->marshaller->unmarshal($values, $dto);
$description = $this->marshaller->unmarshal($values, $dto);

$action = $description->schedule->action ?? null;
if ($action instanceof StartWorkflowAction && $action->workflowId !== '') {
$context = new WorkflowSerializationContext($this->namespace, $action->workflowId);
$action->input->setDataConverter($this->converter);
$action->input->setSerializationContext($context);
$action->memo->setDataConverter($this->converter);
$action->memo->setSerializationContext($context);
}

return $description;
}

/**
Expand Down
8 changes: 5 additions & 3 deletions src/Client/ScheduleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ public function createSchedule(
$options->memo->setDataConverter($this->converter);
$options->searchAttributes->setDataConverter($this->converter);

$namespace = $options->namespace ?? $this->clientOptions->namespace;

$request = new CreateScheduleRequest();
$request
->setRequestId(Uuid::v4())
->setNamespace($options->namespace ?? $this->clientOptions->namespace)
->setNamespace($namespace)
->setScheduleId($scheduleId)
->setIdentity($this->clientOptions->identity);

Expand All @@ -144,7 +146,7 @@ public function createSchedule(
}

$mapper = new ScheduleMapper($this->converter, $this->marshaller);
$scheduleMessage = $mapper->toMessage($schedule);
$scheduleMessage = $mapper->toMessage($schedule, $namespace);

$request
->setSchedule($scheduleMessage)
Expand All @@ -161,7 +163,7 @@ public function createSchedule(
$this->converter,
$this->marshaller,
$this->protoConverter,
$options->namespace ?? $this->clientOptions->namespace,
$namespace,
$scheduleId,
);
}
Expand Down
Loading
Loading