@@ -35,13 +35,13 @@ |
||
| 35 | 35 | ) { |
| 36 | 36 | $this->deferred = new PromiseDeferred(); |
| 37 | 37 | |
| 38 | - $exportResolve(function ($value = null) { |
|
| 38 | + $exportResolve(function($value = null) { |
|
| 39 | 39 | return $this->resolve($value); |
| 40 | 40 | }); |
| 41 | - $exportReject(function ($reason = null) { |
|
| 41 | + $exportReject(function($reason = null) { |
|
| 42 | 42 | return $this->reject($reason); |
| 43 | 43 | }); |
| 44 | - $exportNotify(function ($state = null) { |
|
| 44 | + $exportNotify(function($state = null) { |
|
| 45 | 45 | return $this->notify($state); |
| 46 | 46 | }); |
| 47 | 47 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | protected function defaultConstructorArguments() |
| 24 | 24 | { |
| 25 | - return array(function () { |
|
| 25 | + return array(function() { |
|
| 26 | 26 | return 'foo'; |
| 27 | 27 | }); |
| 28 | 28 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $promisor = $this->newDefaultTestedInstance(), |
| 39 | 39 | $onFulfilled = $this->delegateMock() |
| 40 | 40 | ) |
| 41 | - ->when(function () use ($promisor, $onFulfilled) { |
|
| 41 | + ->when(function() use ($promisor, $onFulfilled) { |
|
| 42 | 42 | $promisor(); |
| 43 | 43 | $promisor->promise()->then($onFulfilled); |
| 44 | 44 | }) |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | ->given( |
| 53 | 53 | $reason = new \Exception(), |
| 54 | 54 | /** @var \Cubiche\Core\Async\Promise\CallablePromisor $promisor */ |
| 55 | - $promisor = $this->newTestedInstance(function () use ($reason) { |
|
| 55 | + $promisor = $this->newTestedInstance(function() use ($reason) { |
|
| 56 | 56 | throw $reason; |
| 57 | 57 | }), |
| 58 | 58 | $onRejected = $this->delegateMock() |
| 59 | 59 | ) |
| 60 | - ->when(function () use ($promisor, $onRejected) { |
|
| 60 | + ->when(function() use ($promisor, $onRejected) { |
|
| 61 | 61 | $promisor(); |
| 62 | 62 | $promisor->promise()->then(null, $onRejected); |
| 63 | 63 | }) |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | ->then() |
| 104 | 104 | ->delegateCall($onRejected) |
| 105 | 105 | ->withArguments($reason) |
| 106 | - ->once() |
|
| 106 | + ->once() |
|
| 107 | 107 | ; |
| 108 | 108 | |
| 109 | 109 | $this->invalidActionTest($deferred); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $deferred = $this->newDefaultTestedInstance(), |
| 121 | 121 | $onNotify = $this->delegateMock() |
| 122 | 122 | ) |
| 123 | - ->when(function () use ($deferred, $onNotify) { |
|
| 123 | + ->when(function() use ($deferred, $onNotify) { |
|
| 124 | 124 | $deferred->promise()->then(null, null, $onNotify); |
| 125 | 125 | $deferred->notify('foo'); |
| 126 | 126 | }) |
@@ -138,15 +138,15 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $this |
| 140 | 140 | ->given($deferred) |
| 141 | - ->exception(function () use ($deferred) { |
|
| 141 | + ->exception(function() use ($deferred) { |
|
| 142 | 142 | $deferred->resolve(); |
| 143 | 143 | }) |
| 144 | 144 | ->isInstanceOf(\LogicException::class) |
| 145 | - ->exception(function () use ($deferred) { |
|
| 145 | + ->exception(function() use ($deferred) { |
|
| 146 | 146 | $deferred->reject(); |
| 147 | 147 | }) |
| 148 | 148 | ->isInstanceOf(\LogicException::class) |
| 149 | - ->exception(function () use ($deferred) { |
|
| 149 | + ->exception(function() use ($deferred) { |
|
| 150 | 150 | $deferred->notify(); |
| 151 | 151 | }) |
| 152 | 152 | ->isInstanceOf(\LogicException::class) |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | protected function defaultConstructorArguments() |
| 44 | 44 | { |
| 45 | 45 | return array( |
| 46 | - function (callable $callable) { |
|
| 46 | + function(callable $callable) { |
|
| 47 | 47 | $this->resolve = new Delegate($callable); |
| 48 | 48 | }, |
| 49 | - function (callable $callable) { |
|
| 49 | + function(callable $callable) { |
|
| 50 | 50 | $this->reject = new Delegate($callable); |
| 51 | 51 | }, |
| 52 | - function (callable $callable) { |
|
| 52 | + function(callable $callable) { |
|
| 53 | 53 | $this->notify = new Delegate($callable); |
| 54 | 54 | }, |
| 55 | 55 | ); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $promise = $this->newDefaultTestedInstance(), |
| 120 | 120 | $onNotify = $this->delegateMock() |
| 121 | 121 | ) |
| 122 | - ->when(function () use ($promise, $onNotify) { |
|
| 122 | + ->when(function() use ($promise, $onNotify) { |
|
| 123 | 123 | $promise->then(null, null, $onNotify); |
| 124 | 124 | $this->notify('foo'); |
| 125 | 125 | }) |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | ->when($deferred->resolve(0)) |
| 92 | 92 | ->then() |
| 93 | 93 | ->boolean($all->state()->equals(State::FULFILLED())) |
| 94 | - ->isTrue() |
|
| 94 | + ->isTrue() |
|
| 95 | 95 | ; |
| 96 | 96 | |
| 97 | 97 | $this |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $promises = array(Promises::fulfilled(0), Promises::fulfilled(1), Promises::fulfilled(2)), |
| 115 | 115 | $onFulfilled = $this->delegateMock() |
| 116 | 116 | ) |
| 117 | - ->when(Promises::map($promises, function ($value) { |
|
| 117 | + ->when(Promises::map($promises, function($value) { |
|
| 118 | 118 | return $value + 1; |
| 119 | 119 | })->then($onFulfilled)) |
| 120 | 120 | ->then() |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $this |
| 165 | 165 | ->given($onRejected = $this->delegateMock()) |
| 166 | - ->when(function () use ($timeout, $onRejected, $loop) { |
|
| 166 | + ->when(function() use ($timeout, $onRejected, $loop) { |
|
| 167 | 167 | $timeout->otherwise($onRejected); |
| 168 | 168 | $loop->run(); |
| 169 | 169 | }) |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $onFulfilled = $this->delegateMock(), |
| 178 | 178 | $timeout = Promises::timeout(Promises::fulfilled('foo'), 0.01, $loop) |
| 179 | 179 | ) |
| 180 | - ->when(function () use ($timeout, $onFulfilled, $loop) { |
|
| 180 | + ->when(function() use ($timeout, $onFulfilled, $loop) { |
|
| 181 | 181 | $timeout->then($onFulfilled); |
| 182 | 182 | $loop->run(); |
| 183 | 183 | }) |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $onRejected = $this->delegateMock(), |
| 194 | 194 | $timeout = Promises::timeout(Promises::rejected($reason), 0.01, $loop) |
| 195 | 195 | ) |
| 196 | - ->when(function () use ($timeout, $onRejected, $loop) { |
|
| 196 | + ->when(function() use ($timeout, $onRejected, $loop) { |
|
| 197 | 197 | $timeout->otherwise($onRejected); |
| 198 | 198 | $loop->run(); |
| 199 | 199 | }) |
@@ -220,8 +220,8 @@ discard block |
||
| 220 | 220 | $this |
| 221 | 221 | ->given($deferred = Promises::defer()) |
| 222 | 222 | ->let($value = null) |
| 223 | - ->when(function () use ($loop, $deferred, &$value) { |
|
| 224 | - $loop->enqueue(function () use ($deferred) { |
|
| 223 | + ->when(function() use ($loop, $deferred, &$value) { |
|
| 224 | + $loop->enqueue(function() use ($deferred) { |
|
| 225 | 225 | $deferred->resolve('bar'); |
| 226 | 226 | }); |
| 227 | 227 | $value = Promises::get($deferred->promise(), $loop); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $this |
| 235 | 235 | ->given($deferred = Promises::defer()) |
| 236 | - ->exception(function () use ($loop, $deferred) { |
|
| 236 | + ->exception(function() use ($loop, $deferred) { |
|
| 237 | 237 | Promises::get($deferred->promise(), $loop, 0.01); |
| 238 | 238 | }) |
| 239 | 239 | ; |
@@ -179,8 +179,8 @@ |
||
| 179 | 179 | ->delegateCall($onFulfilledThen) |
| 180 | 180 | ->never() |
| 181 | 181 | ->delegateCall($onRejectedThen) |
| 182 | - ->withArguments($e) |
|
| 183 | - ->once(); |
|
| 182 | + ->withArguments($e) |
|
| 183 | + ->once(); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $onFulfilledThen = $this->delegateMock(), |
| 168 | 168 | $onNotify = $this->delegateMock() |
| 169 | 169 | ) |
| 170 | - ->when(function () use ($deferred, $thenPromise, $onFulfilledThen, $onNotify) { |
|
| 170 | + ->when(function() use ($deferred, $thenPromise, $onFulfilledThen, $onNotify) { |
|
| 171 | 171 | $thenPromise->then($onFulfilledThen, null, $onNotify); |
| 172 | 172 | $deferred->notify('state'); |
| 173 | 173 | $deferred->resolve('bar'); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | ->given( |
| 296 | 296 | $onFulfilled = $this->delegateMockWithException(new \Exception()) |
| 297 | 297 | ) |
| 298 | - ->exception(function () use ($promise, $onFulfilled) { |
|
| 298 | + ->exception(function() use ($promise, $onFulfilled) { |
|
| 299 | 299 | $promise->done($onFulfilled); |
| 300 | 300 | })->isInstanceof(\Exception::class) |
| 301 | 301 | ; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | ->given( |
| 325 | 325 | $onRejected = $this->delegateMockWithException(new \Exception()) |
| 326 | 326 | ) |
| 327 | - ->exception(function () use ($promise, $onRejected) { |
|
| 327 | + ->exception(function() use ($promise, $onRejected) { |
|
| 328 | 328 | $promise->done(null, $onRejected); |
| 329 | 329 | })->isInstanceof(\Exception::class) |
| 330 | 330 | ; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $this |
| 58 | 58 | ->getAssertionManager() |
| 59 | - ->setHandler('delegateCall', function (MockAggregator $mock) { |
|
| 59 | + ->setHandler('delegateCall', function(MockAggregator $mock) { |
|
| 60 | 60 | return $this->delegateCall($mock); |
| 61 | 61 | }) |
| 62 | 62 | ; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | protected function delegateMock($return = null) |
| 81 | 81 | { |
| 82 | - return $this->callableMock(function ($value = null) use ($return) { |
|
| 82 | + return $this->callableMock(function($value = null) use ($return) { |
|
| 83 | 83 | return $return === null ? $value : $return; |
| 84 | 84 | }); |
| 85 | 85 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | protected function delegateMockWithException(\Exception $e) |
| 103 | 103 | { |
| 104 | - return $this->callableMock(function () use ($e) { |
|
| 104 | + return $this->callableMock(function() use ($e) { |
|
| 105 | 105 | throw $e; |
| 106 | 106 | }); |
| 107 | 107 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | public function testConstructor() |
| 47 | 47 | { |
| 48 | 48 | $this |
| 49 | - ->exception(function () { |
|
| 49 | + ->exception(function() { |
|
| 50 | 50 | $this->newTestedInstance( |
| 51 | 51 | Factory::create(), |
| 52 | 52 | $this->delegateMock(), |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | ) |
| 71 | 71 | /* @var \Cubiche\Core\Async\Loop\Timer\TimerInterface $timer */ |
| 72 | 72 | ->let($timer = $this->newTestedInstance($loop, $task, 0.001)) |
| 73 | - ->when(function () use ($loop, $timer, $onFulfilled) { |
|
| 73 | + ->when(function() use ($loop, $timer, $onFulfilled) { |
|
| 74 | 74 | $timer->then($onFulfilled); |
| 75 | 75 | $loop->run(); |
| 76 | 76 | }) |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | /* @var \Cubiche\Core\Async\Loop\Timer\TimerInterface $timer */ |
| 99 | 99 | ->let($timer = $this->newTestedInstance($loop, $task, 0.001, true, 2)) |
| 100 | 100 | /* @var \Cubiche\Core\Async\Loop\Timer\TimerInterface $timer */ |
| 101 | - ->when(function () use ($loop, $timer, $onRejected, $onNotify) { |
|
| 101 | + ->when(function() use ($loop, $timer, $onRejected, $onNotify) { |
|
| 102 | 102 | $timer->then(null, $onRejected, $onNotify); |
| 103 | 103 | $loop->run(); |
| 104 | 104 | }) |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | return array( |
| 122 | 122 | Factory::create(), |
| 123 | - function () { |
|
| 123 | + function() { |
|
| 124 | 124 | return 'foo'; |
| 125 | 125 | }, |
| 126 | 126 | 0.001, |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | $timeout = $this->newTestedInstance( |
| 138 | 138 | $loop = Factory::create(), |
| 139 | - function () { |
|
| 139 | + function() { |
|
| 140 | 140 | return $this->defaultResolveValue(); |
| 141 | 141 | }, |
| 142 | 142 | 0.001 |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $timer = $this->newTestedInstance( |
| 147 | 147 | $loop = Factory::create(), |
| 148 | - function () { |
|
| 148 | + function() { |
|
| 149 | 149 | throw $this->defaultRejectReason(); |
| 150 | 150 | }, |
| 151 | 151 | 0.001, |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $this |
| 95 | 95 | ->given($onFulfilled = $this->delegateMock()) |
| 96 | - ->when(function () use ($loop, $timer, $onFulfilled) { |
|
| 96 | + ->when(function() use ($loop, $timer, $onFulfilled) { |
|
| 97 | 97 | $timer->then($onFulfilled); |
| 98 | 98 | $loop->tick(); |
| 99 | 99 | }) |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $onRejected = $this->delegateMock(), |
| 140 | 140 | $onNotify = $this->delegateMock() |
| 141 | 141 | ) |
| 142 | - ->when(function () use ($loop, $timer, $onRejected, $onNotify) { |
|
| 142 | + ->when(function() use ($loop, $timer, $onRejected, $onNotify) { |
|
| 143 | 143 | $timer->then(null, $onRejected, $onNotify); |
| 144 | 144 | $loop->run(); |
| 145 | 145 | }) |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | $this |
| 220 | 220 | ->given($onFulfilled = $this->delegateMock()) |
| 221 | - ->when(function () use ($loop, $promise, $onFulfilled) { |
|
| 221 | + ->when(function() use ($loop, $promise, $onFulfilled) { |
|
| 222 | 222 | $promise->then($onFulfilled); |
| 223 | 223 | $loop->tick(); |
| 224 | 224 | }) |