@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | foreach ($promises as $key => $promise) { |
| 81 | 81 | $promise->then( |
| 82 | - function ($value) use ($deferred, &$results, $map, $key, &$pending) { |
|
| 82 | + function($value) use ($deferred, &$results, $map, $key, &$pending) { |
|
| 83 | 83 | if ($map !== null) { |
| 84 | 84 | $value = $map($value); |
| 85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $deferred->resolve($results); |
| 90 | 90 | } |
| 91 | 91 | }, |
| 92 | - function ($reason) use ($deferred) { |
|
| 92 | + function($reason) use ($deferred) { |
|
| 93 | 93 | $deferred->reject($reason); |
| 94 | 94 | } |
| 95 | 95 | ); |
@@ -109,18 +109,18 @@ discard block |
||
| 109 | 109 | { |
| 110 | 110 | $deferred = self::defer(); |
| 111 | 111 | $timer = $loop->timeout( |
| 112 | - function () use ($promise, $deferred, $time) { |
|
| 112 | + function() use ($promise, $deferred, $time) { |
|
| 113 | 113 | $deferred->reject(new TimeoutException($time)); |
| 114 | 114 | }, |
| 115 | 115 | $time |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | 118 | $promise->then( |
| 119 | - function ($value = null) use ($deferred, $timer) { |
|
| 119 | + function($value = null) use ($deferred, $timer) { |
|
| 120 | 120 | $timer->cancel(); |
| 121 | 121 | $deferred->resolve($value); |
| 122 | 122 | }, |
| 123 | - function ($reason = null) use ($deferred, $timer) { |
|
| 123 | + function($reason = null) use ($deferred, $timer) { |
|
| 124 | 124 | $timer->cancel(); |
| 125 | 125 | $deferred->reject($reason); |
| 126 | 126 | } |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $promise->then( |
| 150 | - function ($value = null) use (&$result) { |
|
| 150 | + function($value = null) use (&$result) { |
|
| 151 | 151 | $result = $value; |
| 152 | 152 | }, |
| 153 | - function ($reason = null) use (&$rejectionReason) { |
|
| 153 | + function($reason = null) use (&$rejectionReason) { |
|
| 154 | 154 | $rejectionReason = $reason; |
| 155 | 155 | } |
| 156 | 156 | )->always( |
| 157 | - function () use ($loop) { |
|
| 157 | + function() use ($loop) { |
|
| 158 | 158 | $loop->stop(); |
| 159 | 159 | } |
| 160 | 160 | ); |
@@ -31,11 +31,11 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function always(callable $onFulfilledOrRejected, callable $onNotify = null) |
| 33 | 33 | { |
| 34 | - return $this->then(function ($value) use ($onFulfilledOrRejected) { |
|
| 34 | + return $this->then(function($value) use ($onFulfilledOrRejected) { |
|
| 35 | 35 | $onFulfilledOrRejected($value); |
| 36 | 36 | |
| 37 | 37 | return $value; |
| 38 | - }, function ($reason) use ($onFulfilledOrRejected) { |
|
| 38 | + }, function($reason) use ($onFulfilledOrRejected) { |
|
| 39 | 39 | $onFulfilledOrRejected($reason); |
| 40 | 40 | }, $onNotify); |
| 41 | 41 | } |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | /** |
| 72 | 72 | * @param callable $onFulfilled |
| 73 | 73 | * |
| 74 | - * @return mixed |
|
| 74 | + * @return PromiseInterface |
|
| 75 | 75 | */ |
| 76 | 76 | private function resolveActual(callable $onFulfilled) |
| 77 | 77 | { |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | public function testConstruct() |
| 42 | 42 | { |
| 43 | 43 | $this |
| 44 | - ->exception(function () { |
|
| 44 | + ->exception(function() { |
|
| 45 | 45 | $this->newTestedInstance($this->newDefaultTestedInstance()); |
| 46 | 46 | }) |
| 47 | 47 | ->isInstanceOf(\InvalidArgumentException::class) |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | parent::testResolve(); |
| 26 | 26 | |
| 27 | - $this->innerFailureTest(function (callable $resolveCallback, callable $rejectCallback) { |
|
| 27 | + $this->innerFailureTest(function(callable $resolveCallback, callable $rejectCallback) { |
|
| 28 | 28 | /** @var \Cubiche\Core\Async\Promise\ObservableResolver $resolver */ |
| 29 | 29 | $resolver = $this->newTestedInstance($resolveCallback, $rejectCallback); |
| 30 | 30 | $resolver->resolve(); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | parent::testNotify(); |
| 40 | 40 | |
| 41 | - $this->innerFailureTest(function (callable $notifyCallback, callable $rejectCallback) { |
|
| 41 | + $this->innerFailureTest(function(callable $notifyCallback, callable $rejectCallback) { |
|
| 42 | 42 | /** @var \Cubiche\Core\Async\Promise\ObservableResolver $resolver */ |
| 43 | 43 | $resolver = $this->newTestedInstance(null, $rejectCallback, $notifyCallback); |
| 44 | 44 | $resolver->notify(); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | parent::testResolve(); |
| 26 | 26 | |
| 27 | - $this->innerFailureTest(function (callable $onFulfilled) { |
|
| 27 | + $this->innerFailureTest(function(callable $onFulfilled) { |
|
| 28 | 28 | /** @var \Cubiche\Core\Async\Promise\DoneResolver $resolver */ |
| 29 | 29 | $resolver = $this->newTestedInstance($onFulfilled); |
| 30 | 30 | $resolver->resolve(); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | parent::testReject(); |
| 40 | 40 | |
| 41 | - $this->innerFailureTest(function (callable $onRejected) { |
|
| 41 | + $this->innerFailureTest(function(callable $onRejected) { |
|
| 42 | 42 | /** @var \Cubiche\Core\Async\Promise\DoneResolver $resolver */ |
| 43 | 43 | $resolver = $this->newTestedInstance(null, $onRejected); |
| 44 | 44 | $resolver->reject(); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | parent::testNotify(); |
| 54 | 54 | |
| 55 | - $this->innerFailureTest(function (callable $onNotify) { |
|
| 55 | + $this->innerFailureTest(function(callable $onNotify) { |
|
| 56 | 56 | /** @var \Cubiche\Core\Async\Promise\DoneResolver $resolver */ |
| 57 | 57 | $resolver = $this->newTestedInstance(null, null, $onNotify); |
| 58 | 58 | $resolver->notify(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $reason = new \Exception(), |
| 70 | 70 | $callback = $this->delegateMockWithException($reason) |
| 71 | 71 | ) |
| 72 | - ->exception(function () use ($when, $callback) { |
|
| 72 | + ->exception(function() use ($when, $callback) { |
|
| 73 | 73 | $when($callback); |
| 74 | 74 | }) |
| 75 | 75 | ; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $onFulfilledPromise = $this->delegateMock(), |
| 37 | 37 | $onNotifyPromise = $this->delegateMock() |
| 38 | 38 | ) |
| 39 | - ->when(function () use ($resolver, $onFulfilledPromise, $onNotifyPromise) { |
|
| 39 | + ->when(function() use ($resolver, $onFulfilledPromise, $onNotifyPromise) { |
|
| 40 | 40 | $resolver->resolve(); |
| 41 | 41 | $resolver->promise()->then($onFulfilledPromise, null, $onNotifyPromise); |
| 42 | 42 | }) |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $resolver = $this->newTestedInstance($onFulfilled), |
| 72 | 72 | $onRejectedPromise = $this->delegateMock() |
| 73 | 73 | ) |
| 74 | - ->when(function () use ($resolver, $onRejectedPromise) { |
|
| 74 | + ->when(function() use ($resolver, $onRejectedPromise) { |
|
| 75 | 75 | $resolver->resolve(); |
| 76 | 76 | $resolver->promise()->then(null, $onRejectedPromise); |
| 77 | 77 | }) |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $resolver = $this->newTestedInstance(null, $onRejected), |
| 98 | 98 | $onRejectedPromise = $this->delegateMock() |
| 99 | 99 | ) |
| 100 | - ->when(function () use ($resolver, $onRejectedPromise) { |
|
| 100 | + ->when(function() use ($resolver, $onRejectedPromise) { |
|
| 101 | 101 | $resolver->reject(); |
| 102 | 102 | $resolver->promise()->then(null, $onRejectedPromise); |
| 103 | 103 | }) |
@@ -42,13 +42,13 @@ |
||
| 42 | 42 | { |
| 43 | 43 | if ($this->promise === null) { |
| 44 | 44 | $this->promise = new Promise( |
| 45 | - function (callable $resolveCallback) { |
|
| 45 | + function(callable $resolveCallback) { |
|
| 46 | 46 | $this->resolveCallback = $resolveCallback; |
| 47 | 47 | }, |
| 48 | - function (callable $rejectCallback) { |
|
| 48 | + function(callable $rejectCallback) { |
|
| 49 | 49 | $this->rejectCallback = $rejectCallback; |
| 50 | 50 | }, |
| 51 | - function (callable $notifyCallback) { |
|
| 51 | + function(callable $notifyCallback) { |
|
| 52 | 52 | $this->notifyCallback = $notifyCallback; |
| 53 | 53 | } |
| 54 | 54 | ); |
@@ -66,11 +66,11 @@ |
||
| 66 | 66 | { |
| 67 | 67 | $value = $this->callResolveCallback($value); |
| 68 | 68 | if ($value instanceof PromiseInterface) { |
| 69 | - $value->done(function ($actual) { |
|
| 69 | + $value->done(function($actual) { |
|
| 70 | 70 | $this->deferred->resolve($actual); |
| 71 | - }, function ($reason) { |
|
| 71 | + }, function($reason) { |
|
| 72 | 72 | $this->deferred->reject($reason); |
| 73 | - }, function ($state) { |
|
| 73 | + }, function($state) { |
|
| 74 | 74 | $this->deferred->notify($state); |
| 75 | 75 | }); |
| 76 | 76 | } else { |