Skip to content

Commit e0d5562

Browse files
authored
Merge branch 'master' into issue-642
2 parents 2d9a4e0 + eba4a3e commit e0d5562

File tree

16 files changed

+172
-20
lines changed

16 files changed

+172
-20
lines changed

.github/workflows/run-test-suite.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,20 @@ jobs:
8282
dependency-versions: ${{ matrix.dependencies }}
8383

8484
- name: Validate lowest dependencies
85+
id: validate
8586
if: matrix.dependencies == 'lowest' && matrix.php == '8.1'
8687
env:
8788
COMPOSER_POOL_OPTIMIZER: 0
8889
run: vendor/bin/validate-prefer-lowest
90+
continue-on-error: true
8991

9092
- name: Download binaries
9193
if: inputs.download-binaries == true
9294
run: composer get:binaries
9395

9496
- name: Run tests
9597
run: ${{ inputs.test-command }}
98+
99+
- name: Check for failures
100+
if: steps.validate.outcome == 'failure'
101+
run: exit 1

psalm-baseline.xml

Lines changed: 6 additions & 1 deletion
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.13.1@1e3b7f0a8ab32b23197b91107adc0a7ed8a05b51">
2+
<files psalm-version="6.14.3@d0b040a91f280f071c1abcb1b77ce3822058725a">
33
<file src="src/Activity.php">
44
<ImplicitToStringCast>
55
<code><![CDATA[$type]]></code>
@@ -884,6 +884,11 @@
884884
<code><![CDATA[?string]]></code>
885885
</MoreSpecificReturnType>
886886
</file>
887+
<file src="src/Internal/Promise/CancellationQueue.php">
888+
<PossiblyNullArrayOffset>
889+
<code><![CDATA[$this->queue]]></code>
890+
</PossiblyNullArrayOffset>
891+
</file>
887892
<file src="src/Internal/Queue/ArrayQueue.php">
888893
<InvalidDocblock>
889894
<code><![CDATA[protected array $commands = [];]]></code>

resources/client.meta-storm.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,24 @@
2929
argument="0"
3030
>
3131
<collection name="temporal/sdk:workflow-class" argument="0" />
32+
<collection name="temporal/sdk:workflow-type" argument="0" />
3233
<stopCompletion />
3334
</classMethod>
35+
<classMethod
36+
class="\Temporal\Client\Schedule\Action\StartWorkflowAction"
37+
method="new"
38+
argument="0"
39+
>
40+
<collection name="temporal/sdk:workflow-class" />
41+
<collection name="temporal/sdk:workflow-type" argument="0" />
42+
<stopCompletion />
43+
</classMethod>
44+
<classMethod
45+
class="\Temporal\DataConverter\ValuesInterface"
46+
method="getValue"
47+
argument="1"
48+
>
49+
<languageInjection language="InjectablePHP" prefix="/** @var " suffix=" $_ **/" />
50+
</classMethod>
3451
</definitions>
3552
</meta-storm>

src/Internal/Transport/CompletableResult.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ public function cancel(): void
110110
}
111111

112112
/**
113-
* @deprecated
113+
* @deprecated use {@see catch()} instead
114114
*/
115115
public function otherwise(callable $onRejected): PromiseInterface
116116
{
117117
return $this->catch($onRejected);
118118
}
119119

120120
/**
121-
* @deprecated
121+
* @deprecated use {@see finally()} instead
122122
*/
123123
public function always(callable $onFulfilledOrRejected): PromiseInterface
124124
{

src/Internal/Workflow/Process/Scope.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,17 @@ public function finally(callable $onFulfilledOrRejected): PromiseInterface
259259
return $this->deferred->promise()->finally($onFulfilledOrRejected);
260260
}
261261

262+
/**
263+
* @deprecated use {@see catch()} instead
264+
*/
262265
public function otherwise(callable $onRejected): PromiseInterface
263266
{
264267
return $this->catch($onRejected);
265268
}
266269

270+
/**
271+
* @deprecated use {@see finally()} instead
272+
*/
267273
public function always(callable $onFulfilledOrRejected): PromiseInterface
268274
{
269275
return $this->finally($onFulfilledOrRejected);

src/Worker/Environment/Environment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Environment implements EnvironmentInterface
2020

2121
public function __construct()
2222
{
23-
$this->tickTime = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
23+
$this->tickTime = new \DateTimeImmutable('now');
2424
}
2525

2626
public function now(): \DateTimeInterface

src/Worker/Transport/Codec/JsonCodec.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ final class JsonCodec implements CodecInterface
2323
private int $maxDepth;
2424
private Decoder $parser;
2525
private Encoder $serializer;
26+
private \DateTimeZone $hostTimeZone;
2627

2728
public function __construct(DataConverterInterface $dataConverter, int $maxDepth = 64)
2829
{
2930
$this->maxDepth = $maxDepth;
3031

3132
$this->parser = new Decoder($dataConverter);
3233
$this->serializer = new Encoder($dataConverter);
34+
$this->hostTimeZone = new \DateTimeZone(\date_default_timezone_get());
3335
}
3436

3537
public function encode(iterable $commands): string
@@ -50,15 +52,13 @@ public function encode(iterable $commands): string
5052

5153
public function decode(string $batch, array $headers = []): iterable
5254
{
53-
static $tz = new \DateTimeZone('UTC');
54-
5555
try {
5656
$commands = \json_decode($batch, true, $this->maxDepth, \JSON_THROW_ON_ERROR);
5757

5858
foreach ($commands as $command) {
5959
/** @psalm-suppress ArgumentTypeCoercion */
6060
$info = new TickInfo(
61-
time: new \DateTimeImmutable($headers['tickTime'] ?? 'now', $tz),
61+
time: (new \DateTimeImmutable($headers['tickTime'] ?? 'now'))->setTimezone($this->hostTimeZone),
6262
historyLength: (int) ($headers['history_length'] ?? 0),
6363
historySize: (int) ($headers['history_size'] ?? 0),
6464
continueAsNewSuggested: (bool) ($headers['continue_as_new_suggested'] ?? false),

src/Worker/Transport/Codec/ProtoCodec.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ final class ProtoCodec implements CodecInterface
2626
{
2727
private Decoder $parser;
2828
private Encoder $encoder;
29+
private \DateTimeZone $hostTimeZone;
2930

3031
public function __construct(DataConverterInterface $dataConverter)
3132
{
3233
$this->parser = new Decoder($dataConverter);
3334
$this->encoder = new Encoder($dataConverter);
35+
$this->hostTimeZone = new \DateTimeZone(\date_default_timezone_get());
3436
}
3537

3638
public function encode(iterable $commands): string
@@ -54,16 +56,14 @@ public function encode(iterable $commands): string
5456

5557
public function decode(string $batch, array $headers = []): iterable
5658
{
57-
static $tz = new \DateTimeZone('UTC');
58-
5959
try {
6060
$frame = new Frame();
6161
$frame->mergeFromString($batch);
6262

6363
foreach ($frame->getMessages() as $msg) {
6464
/** @psalm-suppress ArgumentTypeCoercion */
6565
$info = new TickInfo(
66-
time: new \DateTimeImmutable($headers['tickTime'] ?? $msg->getTickTime(), $tz),
66+
time: (new \DateTimeImmutable($headers['tickTime'] ?? $msg->getTickTime()))->setTimezone($this->hostTimeZone),
6767
historyLength: (int) ($headers['history_length'] ?? $msg->getHistoryLength()),
6868
historySize: (int) ($headers['history_size'] ?? $msg->getHistorySize()),
6969
continueAsNewSuggested: (bool) ($headers['continue_as_new_suggested'] ?? $msg->getContinueAsNewSuggested()),

src/Workflow.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ public static function newUntypedExternalWorkflowStub(WorkflowExecution $executi
901901
* ->then(function ($result) {
902902
* // Execution result
903903
* })
904-
* ->otherwise(function (\Throwable $error) {
904+
* ->catch(function (\Throwable $error) {
905905
* // Execution error
906906
* })
907907
* ;

tests/.meta-storm.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<meta-storm>
2+
<definitions>
3+
<classConstructor class="\Temporal\Tests\Acceptance\App\Attribute\Stub" argument="0">
4+
<collection name="temporal/sdk:workflow-type" />
5+
</classConstructor>
6+
</definitions>
7+
</meta-storm>

0 commit comments

Comments
 (0)