Skip to content

Commit

Permalink
Merge pull request #358: Remove react/promise v3 from composer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk authored Oct 4, 2023
2 parents 3bbdb70 + c220b71 commit 3320412
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"nesbot/carbon": "^2.66",
"psr/log": "^2.0 || ^3.0",
"ramsey/uuid": "^4.7",
"react/promise": "2.9 || ^3.0",
"react/promise": "^2.9",
"roadrunner-php/roadrunner-api-dto": "^1.3",
"roadrunner-php/version-checker": "^1.0",
"spiral/attributes": "^2.8 || ^3.0",
Expand Down
61 changes: 53 additions & 8 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -784,13 +784,28 @@
</PossiblyInvalidArgument>
</file>
<file src="src/Internal/Transport/CompletableResult.php">
<InvalidArgument>
<code><![CDATA[$this->wrapContext($onFulfilledOrRejected)]]></code>
<code><![CDATA[$this->wrapContext($onFulfilledOrRejected)]]></code>
</InvalidArgument>
<MoreSpecificImplementedParamType>
<code>$onFulfilled</code>
<code>$onRejected</code>
</MoreSpecificImplementedParamType>
<PossiblyNullArgument>
<code><![CDATA[$this->wrapContext($onFulfilledOrRejected)]]></code>
<code><![CDATA[$this->wrapContext($onRejected)]]></code>
<code>$value</code>
</PossiblyNullArgument>
<TooManyTemplateParams>
<code><![CDATA[PromiseInterface<T>]]></code>
</TooManyTemplateParams>
<UndefinedInterfaceMethod>
<code>cancel</code>
<code>catch</code>
<code>finally</code>
</UndefinedInterfaceMethod>
</file>
<file src="src/Internal/Transport/CompletableResultInterface.php">
<TooManyTemplateParams>
<code>PromiseInterface</code>
</TooManyTemplateParams>
</file>
<file src="src/Internal/Transport/Request/NewTimer.php">
<PossiblyNullPropertyFetch>
Expand Down Expand Up @@ -973,10 +988,6 @@
<ArgumentTypeCoercion>
<code><![CDATA[$this->context]]></code>
</ArgumentTypeCoercion>
<InvalidArgument>
<code>$onFulfilled</code>
<code>$onRejected</code>
</InvalidArgument>
<LessSpecificReturnStatement>
<code><![CDATA[$this->context]]></code>
</LessSpecificReturnStatement>
Expand All @@ -993,6 +1004,8 @@
<code>$coroutine</code>
</PropertyNotSetInConstructor>
<UndefinedInterfaceMethod>
<code>catch</code>
<code>finally</code>
<code>getClient</code>
<code>getClient</code>
<code>getClient</code>
Expand Down Expand Up @@ -1095,6 +1108,11 @@
<TooManyArguments>
<code>$reduce($c, $value, $i++, $total)</code>
</TooManyArguments>
<TooManyTemplateParams>
<code><![CDATA[PromiseInterface<T>]]></code>
<code><![CDATA[PromiseInterface<never>]]></code>
<code><![CDATA[iterable<PromiseInterface<T>|T>]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Worker/ActivityInvocationCache/ActivityInvocationCacheInterface.php">
<MissingParamType>
Expand Down Expand Up @@ -1351,6 +1369,23 @@
)</code>
</UnsafeInstantiation>
</file>
<file src="src/Workflow.php">
<TooManyTemplateParams>
<code><![CDATA[PromiseInterface<TReturn>]]></code>
<code><![CDATA[PromiseInterface<UuidInterface>]]></code>
<code><![CDATA[PromiseInterface<UuidInterface>]]></code>
<code><![CDATA[PromiseInterface<UuidInterface>]]></code>
<code><![CDATA[PromiseInterface<bool>]]></code>
<code><![CDATA[PromiseInterface<int>]]></code>
<code><![CDATA[PromiseInterface<mixed>]]></code>
<code><![CDATA[PromiseInterface<null>]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Workflow/CancellationScopeInterface.php">
<TooManyTemplateParams>
<code>PromiseInterface</code>
</TooManyTemplateParams>
</file>
<file src="src/Workflow/ChildWorkflowOptions.php">
<PossiblyNullReference>
<code>mergeWith</code>
Expand All @@ -1366,4 +1401,14 @@
<code><![CDATA[$e->getCode()]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Workflow/WorkflowContextInterface.php">
<TooManyTemplateParams>
<code><![CDATA[PromiseInterface<TReturn>]]></code>
<code><![CDATA[PromiseInterface<UuidInterface>]]></code>
<code><![CDATA[PromiseInterface<UuidInterface>]]></code>
<code><![CDATA[PromiseInterface<UuidInterface>]]></code>
<code><![CDATA[PromiseInterface<bool>]]></code>
<code><![CDATA[PromiseInterface<mixed>]]></code>
</TooManyTemplateParams>
</file>
</files>
10 changes: 8 additions & 2 deletions src/Internal/Transport/CompletableResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public function __construct(
$this->layer = $layer;

$this->promise = $promise->then(
\Closure::fromCallable([$this, 'onFulfilled']),
\Closure::fromCallable([$this, 'onRejected']),
$this->onFulfilled(...),
$this->onRejected(...),
);
}

Expand Down Expand Up @@ -171,11 +171,17 @@ public function cancel(): void
$this->promise()->cancel();
}

/**
* @deprecated
*/
public function otherwise(callable $onRejected): PromiseInterface
{
return $this->catch($this->wrapContext($onRejected));
}

/**
* @deprecated
*/
public function always(callable $onFulfilledOrRejected): PromiseInterface
{
return $this->finally($this->wrapContext($onFulfilledOrRejected));
Expand Down

0 comments on commit 3320412

Please sign in to comment.