diff --git a/src/LazyPromise.php b/src/LazyPromise.php index 91f3e308..401dd34f 100644 --- a/src/LazyPromise.php +++ b/src/LazyPromise.php @@ -31,6 +31,7 @@ private function promise() $this->promise = new RejectedPromise($exception); } } + return $this->promise; } } diff --git a/src/Promise.php b/src/Promise.php index 6fe9a3a0..ead3106e 100644 --- a/src/Promise.php +++ b/src/Promise.php @@ -27,7 +27,7 @@ public function then(callable $onFulfilled = null, callable $onRejected = null, $this->requiredCancelRequests++; - return new static($this->resolver($onFulfilled, $onRejected, $onProgress), function($resolve, $reject, $progress) { + return new static($this->resolver($onFulfilled, $onRejected, $onProgress), function ($resolve, $reject, $progress) { if (++$this->cancelRequests < $this->requiredCancelRequests) { return; } diff --git a/tests/PromiseTest/CancelTestTrait.php b/tests/PromiseTest/CancelTestTrait.php index 0ff78ab6..d6c09566 100644 --- a/tests/PromiseTest/CancelTestTrait.php +++ b/tests/PromiseTest/CancelTestTrait.php @@ -110,7 +110,7 @@ public function cancelShouldCallCancellerOnlyOnceIfCancellerResolves() $mock ->expects($this->once()) ->method('__invoke') - ->will($this->returnCallback(function($resolve) { + ->will($this->returnCallback(function ($resolve) { $resolve(); })); @@ -144,15 +144,15 @@ public function cancelShouldCallCancellerFromDeepNestedPromiseChain() $promise = $adapter->promise() ->then(function () { - return new Promise\Promise(function() {}); + return new Promise\Promise(function () {}); }) - ->then(function() { + ->then(function () { $d = new Promise\Deferred(); return $d->promise(); }) ->then(function () { - return new Promise\Promise(function() {}); + return new Promise\Promise(function () {}); }); $promise->cancel();