Skip to content

Commit

Permalink
Optimize Promise v3 API compatibility to avoid hitting autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Jun 17, 2022
1 parent 2bc106d commit 133bafb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 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 @@
"react/cache": "^1.0 || ^0.6 || ^0.5",
"react/event-loop": "^1.2",
"react/promise": "^3.0 || ^2.7 || ^1.2.1",
"react/promise-timer": "^1.8"
"react/promise-timer": "^1.9"
},
"require-dev": {
"clue/block-react": "^1.2",
Expand Down
3 changes: 1 addition & 2 deletions src/Query/RetryExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace React\Dns\Query;

use React\Promise\CancellablePromiseInterface;
use React\Promise\Deferred;
use React\Promise\PromiseInterface;

Expand All @@ -25,7 +24,7 @@ public function query(Query $query)
public function tryQuery(Query $query, $retries)
{
$deferred = new Deferred(function () use (&$promise) {
if ($promise instanceof CancellablePromiseInterface || (!\interface_exists('React\Promise\CancellablePromiseInterface') && \method_exists($promise, 'cancel'))) {
if ($promise instanceof PromiseInterface && \method_exists($promise, 'cancel')) {
$promise->cancel();
}
});
Expand Down

0 comments on commit 133bafb

Please sign in to comment.