Skip to content

Commit 7f4050d

Browse files
authored
Merge branch 'master' into local-activity-summary
2 parents b748f0d + eba4a3e commit 7f4050d

File tree

9 files changed

+82
-13
lines changed

9 files changed

+82
-13
lines changed

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/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>

tests/Acceptance/App/Attribute/RetryOptions.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@ class RetryOptions
2525
* @param int<0, max> $maximumAttempts
2626
*/
2727
public function __construct(
28+
/**
29+
* @see CommonOptions::withInitialInterval()
30+
*/
2831
public ?string $initialInterval = CommonOptions::DEFAULT_INITIAL_INTERVAL,
32+
/**
33+
* @see CommonOptions::withBackoffCoefficient()
34+
*/
2935
public float $backoffCoefficient = CommonOptions::DEFAULT_BACKOFF_COEFFICIENT,
36+
/**
37+
* @see CommonOptions::withMaximumInterval()
38+
*/
3039
public ?string $maximumInterval = CommonOptions::DEFAULT_MAXIMUM_INTERVAL,
40+
/**
41+
* @see CommonOptions::withMaximumAttempts()
42+
*/
3143
public int $maximumAttempts = CommonOptions::DEFAULT_MAXIMUM_ATTEMPTS,
44+
/**
45+
* @see CommonOptions::withNonRetryableExceptions()
46+
*/
3247
public array $nonRetryableExceptions = CommonOptions::DEFAULT_NON_RETRYABLE_EXCEPTIONS,
3348
) {}
3449

tests/Acceptance/App/Attribute/Stub.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,26 @@ final class Stub
2323
*/
2424
public function __construct(
2525
public string $type,
26+
/**
27+
* @see WorkflowOptions::withEagerStart()
28+
*/
2629
public bool $eagerStart = false,
30+
/**
31+
* @see WorkflowOptions::withWorkflowId()
32+
*/
2733
public ?string $workflowId = null,
34+
/**
35+
* @see WorkflowOptions::withWorkflowExecutionTimeout()
36+
*/
2837
public ?string $executionTimeout = null,
2938
public array $args = [],
39+
/**
40+
* @see WorkflowOptions::withMemo()
41+
*/
3042
public array $memo = [],
43+
/**
44+
* @see WorkflowOptions::withRetryOptions()
45+
*/
3146
?RetryOptions $retryOptions = null,
3247
) {
3348
$this->retryOptions = $retryOptions?->toRetryOptions();

tests/Acceptance/App/TestCase.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
use Google\Protobuf\Timestamp;
88
use PHPUnit\Framework\SkippedTest;
9-
use PHPUnit\Framework\SkippedWithMessageException;
10-
use PHPUnit\Framework\TestStatus\Skipped;
119
use Psr\Log\LoggerInterface;
1210
use Spiral\Core\Container;
1311
use Spiral\Core\Scope;
@@ -36,16 +34,16 @@ protected function setUp(): void
3634

3735
protected function runTest(): mixed
3836
{
39-
$c = ContainerFacade::$container;
37+
$container = ContainerFacade::$container;
4038
/** @var State $runtime */
41-
$runtime = $c->get(State::class);
39+
$runtime = $container->get(State::class);
4240
$feature = $runtime->getFeatureByTestCase(static::class);
4341

4442
// Configure client logger
4543
$logger = LoggerFactory::createClientLogger($feature->taskQueue);
4644
$logger->clear();
4745

48-
return $c->runScope(
46+
return $container->runScope(
4947
new Scope(name: 'feature', bindings: [
5048
Feature::class => $feature,
5149
static::class => $this,
@@ -62,7 +60,15 @@ function (Container $container): mixed {
6260
return parent::runTest();
6361
} catch (\Throwable $e) {
6462
if ($e instanceof TemporalException) {
65-
echo "\n=== Workflow history for failed test {$this->name()} ===\n";
63+
echo \sprintf(
64+
"\n=== En error occurred while testing %s: %s (%s) ===\n",
65+
static::class . '::' . $this->name(),
66+
$e->getMessage(),
67+
$e::class,
68+
);
69+
echo "\n=== Stack trace ===\n";
70+
echo $e->getTraceAsString();
71+
echo "\n=== Workflow history ===\n";
6672
$this->printWorkflowHistory($container->get(WorkflowClientInterface::class), $args);
6773

6874
$logRecords = $container->get(ClientLogger::class)->getRecords();
@@ -117,9 +123,7 @@ private function printWorkflowHistory(WorkflowClientInterface $workflowClient, a
117123
? 0
118124
: $ts->getSeconds() + \round($ts->getNanos() / 1_000_000_000, 6);
119125

120-
foreach ($workflowClient->getWorkflowHistory(
121-
$arg->getExecution(),
122-
) as $event) {
126+
foreach ($workflowClient->getWorkflowHistory($arg->getExecution()) as $event) {
123127
$start ??= $fnTime($event->getEventTime());
124128
echo "\n" . \str_pad((string) $event->getEventId(), 3, ' ', STR_PAD_LEFT) . ' ';
125129
# Calculate delta time

0 commit comments

Comments
 (0)