Skip to content

Commit 7017bad

Browse files
committed
Merge pull request #28 from clue-labs/react04
Fix compatibility with react/promise v2.0
2 parents abe5232 + c328743 commit 7017bad

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ php:
66
services:
77
- redis-server
88
before_script:
9-
- composer install --dev --prefer-source --no-interaction
9+
- composer update --dev --prefer-source --no-interaction
1010
script:
1111
- phpunit --coverage-text

src/StreamingClient.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public function __construct(Stream $stream, ParserInterface $parser = null, Seri
7777
public function __call($name, $args)
7878
{
7979
$request = new Deferred();
80+
$promise = $request->promise();
8081

8182
$name = strtolower($name);
8283

@@ -94,15 +95,15 @@ public function __call($name, $args)
9495

9596
if ($name === 'monitor') {
9697
$monitoring =& $this->monitoring;
97-
$request->then(function () use (&$monitoring) {
98+
$promise->then(function () use (&$monitoring) {
9899
$monitoring = true;
99100
});
100101
} elseif (in_array($name, $pubsubs)) {
101102
$that = $this;
102103
$subscribed =& $this->subscribed;
103104
$psubscribed =& $this->psubscribed;
104105

105-
$request->then(function ($array) use ($that, &$subscribed, &$psubscribed) {
106+
$promise->then(function ($array) use ($that, &$subscribed, &$psubscribed) {
106107
$first = array_shift($array);
107108

108109
// (p)(un)subscribe messages are to be forwarded
@@ -117,7 +118,7 @@ public function __call($name, $args)
117118
});
118119
}
119120

120-
return $request->promise();
121+
return $promise;
121122
}
122123

123124
public function handleMessage(ModelInterface $message)

0 commit comments

Comments
 (0)