Skip to content

Commit 86cdf75

Browse files
authored
Merge pull request #616: Expose metadata query support
2 parents 210746d + b24cedf commit 86cdf75

39 files changed

+1260
-669
lines changed

psalm-baseline.xml

Lines changed: 119 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.10.0@9c0add4eb88d4b169ac04acb7c679918cbb9c252">
2+
<files psalm-version="6.12.0@cf420941d061a57050b6c468ef2c778faf40aee2">
33
<file src="src/Activity.php">
44
<ImplicitToStringCast>
55
<code><![CDATA[$type]]></code>
@@ -115,6 +115,11 @@
115115
<code><![CDATA[$workflowType]]></code>
116116
</PropertyNotSetInConstructor>
117117
</file>
118+
<file src="src/Client/Schedule/ScheduleHandle.php">
119+
<RawObjectIteration>
120+
<code><![CDATA[$response->getStartTime()]]></code>
121+
</RawObjectIteration>
122+
</file>
118123
<file src="src/Client/Schedule/ScheduleOptions.php">
119124
<DeprecatedProperty>
120125
<code><![CDATA[$this->namespace]]></code>
@@ -134,13 +139,22 @@
134139
<code><![CDATA[$options->namespace]]></code>
135140
<code><![CDATA[$options->namespace]]></code>
136141
</DeprecatedProperty>
142+
<RawObjectIteration>
143+
<code><![CDATA[$response->getSchedules()]]></code>
144+
</RawObjectIteration>
145+
</file>
146+
<file src="src/Client/Workflow/WorkflowExecutionHistory.php">
147+
<RawObjectIteration>
148+
<code><![CDATA[$history->getEvents()]]></code>
149+
</RawObjectIteration>
137150
</file>
138151
<file src="src/Client/WorkflowClient.php">
139152
<ArgumentTypeCoercion>
140153
<code><![CDATA[$counter]]></code>
154+
<code><![CDATA[$runID]]></code>
141155
<code><![CDATA[$signal]]></code>
142-
<code><![CDATA[$workflowType]]></code>
143-
<code><![CDATA[$workflowType]]></code>
156+
<code><![CDATA[$workflow->getID()]]></code>
157+
<code><![CDATA[$workflow->getID()]]></code>
144158
</ArgumentTypeCoercion>
145159
<DeprecatedClass>
146160
<code><![CDATA[new AnnotationReader()]]></code>
@@ -170,6 +184,9 @@
170184
<MoreSpecificReturnType>
171185
<code><![CDATA[static]]></code>
172186
</MoreSpecificReturnType>
187+
<RawObjectIteration>
188+
<code><![CDATA[$response->getExecutions()]]></code>
189+
</RawObjectIteration>
173190
<RedundantFunctionCall>
174191
<code><![CDATA[\sprintf]]></code>
175192
<code><![CDATA[\sprintf]]></code>
@@ -216,6 +233,11 @@
216233
<code><![CDATA[RetryOptions]]></code>
217234
</MissingImmutableAnnotation>
218235
</file>
236+
<file src="src/Common/Priority.php">
237+
<ArgumentTypeCoercion>
238+
<code><![CDATA[$priorityKey]]></code>
239+
</ArgumentTypeCoercion>
240+
</file>
219241
<file src="src/Common/RetryOptions.php">
220242
<PossiblyNullArgument>
221243
<code><![CDATA[DateInterval::toDuration($this->initialInterval)]]></code>
@@ -285,6 +307,10 @@
285307
</MoreSpecificImplementedParamType>
286308
</file>
287309
<file src="src/DataConverter/EncodedValues.php">
310+
<InvalidArgument>
311+
<code><![CDATA[$payloads->getPayloads()]]></code>
312+
<code><![CDATA[$payloads->getPayloads()]]></code>
313+
</InvalidArgument>
288314
<PossiblyNullIterator>
289315
<code><![CDATA[$this->values]]></code>
290316
</PossiblyNullIterator>
@@ -354,6 +380,39 @@
354380
<code><![CDATA[new static('', $e->getCode(), $e)]]></code>
355381
</UnsafeInstantiation>
356382
</file>
383+
<file src="src/Exception/Client/MultyOperation/OperationStatus.php">
384+
<InvalidArgument>
385+
<code><![CDATA[$message->getDetails()]]></code>
386+
</InvalidArgument>
387+
<MismatchingDocblockParamType>
388+
<code><![CDATA[\ArrayAccess<int, Any>&RepeatedField]]></code>
389+
</MismatchingDocblockParamType>
390+
<MismatchingDocblockPropertyType>
391+
<code><![CDATA[\ArrayAccess<int, Any>&RepeatedField]]></code>
392+
</MismatchingDocblockPropertyType>
393+
<MismatchingDocblockReturnType>
394+
<code><![CDATA[\ArrayAccess<int, Any>&RepeatedField]]></code>
395+
</MismatchingDocblockReturnType>
396+
</file>
397+
<file src="src/Exception/Client/ServiceClientException.php">
398+
<ImplementedReturnTypeMismatch>
399+
<code><![CDATA[RepeatedField]]></code>
400+
</ImplementedReturnTypeMismatch>
401+
<InvalidReturnStatement>
402+
<code><![CDATA[$this->status->getDetails()]]></code>
403+
</InvalidReturnStatement>
404+
<InvalidReturnType>
405+
<code><![CDATA[RepeatedField]]></code>
406+
</InvalidReturnType>
407+
</file>
408+
<file src="src/Exception/Client/UnpackDetailsTrait.php">
409+
<RawObjectIteration>
410+
<code><![CDATA[$details]]></code>
411+
</RawObjectIteration>
412+
<UndefinedInterfaceMethod>
413+
<code><![CDATA[count]]></code>
414+
</UndefinedInterfaceMethod>
415+
</file>
357416
<file src="src/Exception/Client/WorkflowException.php">
358417
<UnsafeInstantiation>
359418
<code><![CDATA[new static(null, $execution, $workflowType, $previous)]]></code>
@@ -373,6 +432,10 @@
373432
</MoreSpecificReturnType>
374433
</file>
375434
<file src="src/Exception/Failure/FailureConverter.php">
435+
<ArgumentTypeCoercion>
436+
<code><![CDATA[$execution->getRunId()]]></code>
437+
<code><![CDATA[$execution->getWorkflowId()]]></code>
438+
</ArgumentTypeCoercion>
376439
<DocblockTypeContradiction>
377440
<code><![CDATA[\is_array($frame)]]></code>
378441
</DocblockTypeContradiction>
@@ -442,7 +505,26 @@
442505
<code><![CDATA[$details]]></code>
443506
</MissingParamType>
444507
</file>
508+
<file src="src/Internal/Client/ResponseToResultMapper.php">
509+
<ArgumentTypeCoercion>
510+
<code><![CDATA[$execution->getRunId()]]></code>
511+
<code><![CDATA[$execution->getWorkflowId()]]></code>
512+
<code><![CDATA[$updateRef->getWorkflowExecution()?->getRunId()]]></code>
513+
<code><![CDATA[(string) $updateRef->getWorkflowExecution()?->getWorkflowId()]]></code>
514+
</ArgumentTypeCoercion>
515+
</file>
445516
<file src="src/Internal/Client/WorkflowStarter.php">
517+
<ArgumentTypeCoercion>
518+
<code><![CDATA[$f->getRunId()]]></code>
519+
<code><![CDATA[$f->getRunId()]]></code>
520+
<code><![CDATA[$input->workflowStartInput->workflowId]]></code>
521+
<code><![CDATA[$input->workflowStartInput->workflowId]]></code>
522+
<code><![CDATA[$options->workflowId]]></code>
523+
<code><![CDATA[$request->getWorkflowId()]]></code>
524+
<code><![CDATA[$request->getWorkflowId()]]></code>
525+
<code><![CDATA[$response->getRunId()]]></code>
526+
<code><![CDATA[$startResponse->getRunId()]]></code>
527+
</ArgumentTypeCoercion>
446528
<InvalidArgument>
447529
<code><![CDATA[0]]></code>
448530
<code><![CDATA[1]]></code>
@@ -461,6 +543,11 @@
461543
</UndefinedInterfaceMethod>
462544
</file>
463545
<file src="src/Internal/Client/WorkflowStub.php">
546+
<ArgumentTypeCoercion>
547+
<code><![CDATA[$closeEvent
548+
->getWorkflowExecutionContinuedAsNewEventAttributes()
549+
->getNewExecutionRunId()]]></code>
550+
</ArgumentTypeCoercion>
464551
<PossiblyInvalidArgument>
465552
<code><![CDATA[$closeEvent->getTaskId()]]></code>
466553
</PossiblyInvalidArgument>
@@ -589,9 +676,6 @@
589676
<InvalidReturnType>
590677
<code><![CDATA[\Traversable<ActivityPrototype>]]></code>
591678
</InvalidReturnType>
592-
<PossiblyUndefinedVariable>
593-
<code><![CDATA[$contextClass]]></code>
594-
</PossiblyUndefinedVariable>
595679
<RawObjectIteration>
596680
<code><![CDATA[$group]]></code>
597681
<code><![CDATA[$group]]></code>
@@ -600,20 +684,24 @@
600684
<code><![CDATA[$retry !== null]]></code>
601685
</RedundantConditionGivenDocblockType>
602686
</file>
603-
<file src="src/Internal/Declaration/WorkflowInstance.php">
604-
<LessSpecificImplementedReturnType>
605-
<code><![CDATA[UpdateHandler|null]]></code>
606-
</LessSpecificImplementedReturnType>
687+
<file src="src/Internal/Declaration/WorkflowInstance/QueryDispatcher.php">
607688
<PropertyNotSetInConstructor>
608689
<code><![CDATA[$queryExecutor]]></code>
609-
<code><![CDATA[$updateExecutor]]></code>
610-
<code><![CDATA[$updateValidator]]></code>
611690
</PropertyNotSetInConstructor>
612691
</file>
613-
<file src="src/Internal/Declaration/WorkflowInstance/SignalQueue.php">
614-
<MissingConstructor>
692+
<file src="src/Internal/Declaration/WorkflowInstance/SignalDispatcher.php">
693+
<InvalidReturnStatement>
694+
<code><![CDATA[$this->push($name, $values)]]></code>
695+
</InvalidReturnStatement>
696+
<PropertyNotSetInConstructor>
615697
<code><![CDATA[$onSignal]]></code>
616-
</MissingConstructor>
698+
</PropertyNotSetInConstructor>
699+
</file>
700+
<file src="src/Internal/Declaration/WorkflowInstance/UpdateDispatcher.php">
701+
<PropertyNotSetInConstructor>
702+
<code><![CDATA[$updateExecutor]]></code>
703+
<code><![CDATA[$updateValidator]]></code>
704+
</PropertyNotSetInConstructor>
617705
</file>
618706
<file src="src/Internal/Events/EventEmitterInterface.php">
619707
<InvalidTemplateParam>
@@ -678,6 +766,8 @@
678766
</file>
679767
<file src="src/Internal/Mapper/WorkflowExecutionInfoMapper.php">
680768
<ArgumentTypeCoercion>
769+
<code><![CDATA[$execution->getRunId()]]></code>
770+
<code><![CDATA[$execution->getWorkflowId()]]></code>
681771
<code><![CDATA[$message->getTaskQueue()]]></code>
682772
<code><![CDATA[(int) $message->getHistorySizeBytes()]]></code>
683773
<code><![CDATA[(int) $message->getStateTransitionCount()]]></code>
@@ -689,6 +779,9 @@
689779
<code><![CDATA[parse]]></code>
690780
<code><![CDATA[parse]]></code>
691781
</DocblockTypeContradiction>
782+
<RawObjectIteration>
783+
<code><![CDATA[$getAutoResetPoints->getPoints()]]></code>
784+
</RawObjectIteration>
692785
<RedundantConditionGivenDocblockType>
693786
<code><![CDATA[parse]]></code>
694787
</RedundantConditionGivenDocblockType>
@@ -758,6 +851,9 @@
758851
\sprintf('%d.%d', $input->getSeconds(), $input->getNanos() / 1000),
759852
)]]></code>
760853
</FalsableReturnStatement>
854+
<InvalidArgument>
855+
<code><![CDATA[$input->getPayloads()]]></code>
856+
</InvalidArgument>
761857
<InvalidFalsableReturnType>
762858
<code><![CDATA[\DateTimeImmutable]]></code>
763859
</InvalidFalsableReturnType>
@@ -770,6 +866,9 @@
770866
<NullableReturnStatement>
771867
<code><![CDATA[$mapper]]></code>
772868
</NullableReturnStatement>
869+
<PossibleRawObjectIteration>
870+
<code><![CDATA[$value]]></code>
871+
</PossibleRawObjectIteration>
773872
<PossiblyNullArgument>
774873
<code><![CDATA[$metadata->getDetails()]]></code>
775874
<code><![CDATA[$metadata->getSummary()]]></code>
@@ -1023,25 +1122,10 @@
10231122
<ArgumentTypeCoercion>
10241123
<code><![CDATA[$request->getID()]]></code>
10251124
</ArgumentTypeCoercion>
1026-
<PossiblyUndefinedStringArrayOffset>
1027-
<code><![CDATA[$request->getOptions()['name']]]></code>
1028-
</PossiblyUndefinedStringArrayOffset>
1029-
<UndefinedInterfaceMethod>
1030-
<code><![CDATA[getQueryHandlerNames]]></code>
1031-
</UndefinedInterfaceMethod>
10321125
<UnusedVariable>
10331126
<code><![CDATA[$headers]]></code>
10341127
</UnusedVariable>
10351128
</file>
1036-
<file src="src/Internal/Transport/Router/InvokeSignal.php">
1037-
<ArgumentTypeCoercion>
1038-
<code><![CDATA[$request->getID()]]></code>
1039-
<code><![CDATA[$request->getID()]]></code>
1040-
</ArgumentTypeCoercion>
1041-
<PossiblyUndefinedStringArrayOffset>
1042-
<code><![CDATA[$request->getOptions()['name']]]></code>
1043-
</PossiblyUndefinedStringArrayOffset>
1044-
</file>
10451129
<file src="src/Internal/Transport/Router/InvokeUpdate.php">
10461130
<ArgumentTypeCoercion>
10471131
<code><![CDATA[$request->getID()]]></code>
@@ -1052,8 +1136,6 @@
10521136
</PossiblyUndefinedStringArrayOffset>
10531137
<UndefinedInterfaceMethod>
10541138
<code><![CDATA[cancel]]></code>
1055-
<code><![CDATA[findValidateUpdateHandler]]></code>
1056-
<code><![CDATA[getUpdateHandlerNames]]></code>
10571139
</UndefinedInterfaceMethod>
10581140
</file>
10591141
<file src="src/Internal/Transport/Router/StackTrace.php">
@@ -1333,6 +1415,9 @@
13331415
<code><![CDATA[$e->getCode()]]></code>
13341416
<code><![CDATA[$e->getCode()]]></code>
13351417
</PossiblyInvalidArgument>
1418+
<RawObjectIteration>
1419+
<code><![CDATA[$frame->getMessages()]]></code>
1420+
</RawObjectIteration>
13361421
<TooManyArguments>
13371422
<code><![CDATA[decode]]></code>
13381423
</TooManyArguments>
@@ -1491,8 +1576,8 @@
14911576
<file src="src/Workflow.php">
14921577
<InvalidReturnStatement>
14931578
<code><![CDATA[self::getCurrentContext()->newActivityStub($class, $options)]]></code>
1494-
<code><![CDATA[self::getCurrentContext()->registerQuery($queryType, $handler)]]></code>
1495-
<code><![CDATA[self::getCurrentContext()->registerSignal($name, $handler)]]></code>
1579+
<code><![CDATA[self::getCurrentContext()->registerQuery($queryType, $handler, $description)]]></code>
1580+
<code><![CDATA[self::getCurrentContext()->registerSignal($name, $handler, $description)]]></code>
14961581
</InvalidReturnStatement>
14971582
<InvalidReturnType>
14981583
<code><![CDATA[ScopedContextInterface]]></code>

psalm.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@
2424
<issueHandlers>
2525
<MissingOverrideAttribute errorLevel="suppress" />
2626
<ClassMustBeFinal errorLevel="suppress" />
27+
<DeprecatedClass>
28+
<errorLevel type="suppress">
29+
<referencedClass name="Google\Protobuf\Internal\RepeatedField" />
30+
</errorLevel>
31+
</DeprecatedClass>
2732
</issueHandlers>
2833
</psalm>

src/Activity.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ public static function doNotCompleteOnReturn(): void
132132
*
133133
* @param mixed $details In case of activity timeout details are returned
134134
* as a field of the exception thrown.
135+
*
135136
* @throws OutOfContextException in the absence of the activity execution context.
136137
*/
137138
public static function heartbeat($details): void

src/Client/WorkflowClientInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public function newWorkflowStub(
110110
*
111111
* IMPORTANT! Stub is per workflow instance. So new stub should be created
112112
* for each new one.
113+
*
114+
* @param non-empty-string $workflowType
113115
*/
114116
public function newUntypedWorkflowStub(
115117
string $workflowType,
@@ -121,6 +123,7 @@ public function newUntypedWorkflowStub(
121123
*
122124
* @psalm-template T of object
123125
* @param class-string<T> $class
126+
* @param non-empty-string $workflowID
124127
* @return T
125128
*/
126129
public function newRunningWorkflowStub(
@@ -131,6 +134,10 @@ public function newRunningWorkflowStub(
131134

132135
/**
133136
* Returns untyped workflow stub associated with running workflow.
137+
*
138+
* @param non-empty-string $workflowID
139+
* @param non-empty-string|null $runID
140+
* @param non-empty-string|null $workflowType
134141
*/
135142
public function newUntypedRunningWorkflowStub(
136143
string $workflowID,

src/Common/Priority.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,17 @@ final class Priority
4545
#[Marshal(name: 'PriorityKey')]
4646
public int $priorityKey = 0;
4747

48+
/**
49+
* @param int<0, max> $priorityKey
50+
*/
4851
private function __construct(int $priorityKey = 0)
4952
{
5053
$this->priorityKey = $priorityKey;
5154
}
5255

56+
/**
57+
* Create a new Priority instance.
58+
*/
5359
public static function new(int $priorityKey = 0): self
5460
{
5561
return new self($priorityKey);

src/Common/Uuid.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ final class Uuid
2525
*/
2626
public const NIL = '00000000-0000-0000-0000-000000000000';
2727

28+
/**
29+
* @return non-empty-string
30+
*/
2831
public static function nil(): string
2932
{
3033
return self::NIL;

0 commit comments

Comments
 (0)