@@ -49,16 +49,16 @@ |
||
| 49 | 49 | protected function defaultConstructorArguments() |
| 50 | 50 | { |
| 51 | 51 | return array( |
| 52 | - function (callable $callable) { |
|
| 52 | + function(callable $callable) { |
|
| 53 | 53 | $this->resolve = new Delegate($callable); |
| 54 | 54 | }, |
| 55 | - function (callable $callable) { |
|
| 55 | + function(callable $callable) { |
|
| 56 | 56 | $this->reject = new Delegate($callable); |
| 57 | 57 | }, |
| 58 | - function (callable $callable) { |
|
| 58 | + function(callable $callable) { |
|
| 59 | 59 | $this->notify = new Delegate($callable); |
| 60 | 60 | }, |
| 61 | - function (callable $callable) { |
|
| 61 | + function(callable $callable) { |
|
| 62 | 62 | $this->cancel = new Delegate($callable); |
| 63 | 63 | }, |
| 64 | 64 | ); |
@@ -67,16 +67,16 @@ |
||
| 67 | 67 | { |
| 68 | 68 | if ($this->promise === null) { |
| 69 | 69 | $this->promise = new Promise( |
| 70 | - new Delegate(function (callable $callable) { |
|
| 70 | + new Delegate(function(callable $callable) { |
|
| 71 | 71 | $this->resolveDelegate = new Delegate($callable); |
| 72 | 72 | }), |
| 73 | - new Delegate(function (callable $callable) { |
|
| 73 | + new Delegate(function(callable $callable) { |
|
| 74 | 74 | $this->rejectDelegate = new Delegate($callable); |
| 75 | 75 | }), |
| 76 | - new Delegate(function (callable $callable) { |
|
| 76 | + new Delegate(function(callable $callable) { |
|
| 77 | 77 | $this->notifyDelegate = new Delegate($callable); |
| 78 | 78 | }), |
| 79 | - new Delegate(function (callable $callable) { |
|
| 79 | + new Delegate(function(callable $callable) { |
|
| 80 | 80 | $this->cancelDelegate = new Delegate($callable); |
| 81 | 81 | }) |
| 82 | 82 | ); |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | $this->rejectedDelegates = array(); |
| 67 | 67 | $this->notifyDelegates = array(); |
| 68 | 68 | |
| 69 | - $exportResolve(function ($value = null) { |
|
| 69 | + $exportResolve(function($value = null) { |
|
| 70 | 70 | return $this->resolve($value); |
| 71 | 71 | }); |
| 72 | - $exportReject(function ($reason = null) { |
|
| 72 | + $exportReject(function($reason = null) { |
|
| 73 | 73 | return $this->reject($reason); |
| 74 | 74 | }); |
| 75 | - $exportNotify(function ($state = null) { |
|
| 75 | + $exportNotify(function($state = null) { |
|
| 76 | 76 | return $this->notify($state); |
| 77 | 77 | }); |
| 78 | - $exportCancel(function () { |
|
| 78 | + $exportCancel(function() { |
|
| 79 | 79 | return $this->cancel(); |
| 80 | 80 | }); |
| 81 | 81 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | private function addSucceedDelegate(DeferredInterface $deferred, callable $succeed = null) |
| 106 | 106 | { |
| 107 | 107 | if ($this->state === self::WAITING || $this->state === self::COMPLETED) { |
| 108 | - $this->succeedDelegates[] = new Delegate(function ($value = null) use ($succeed, $deferred) { |
|
| 108 | + $this->succeedDelegates[] = new Delegate(function($value = null) use ($succeed, $deferred) { |
|
| 109 | 109 | $actual = $value; |
| 110 | 110 | if ($succeed !== null) { |
| 111 | 111 | $actual = $succeed($value); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | private function addRejectedDelegate(DeferredInterface $deferred, callable $rejected = null) |
| 124 | 124 | { |
| 125 | 125 | if ($this->state === self::WAITING || $this->state === self::REJECTED) { |
| 126 | - $this->rejectedDelegates[] = new Delegate(function ($reason = null) use ($rejected, $deferred) { |
|
| 126 | + $this->rejectedDelegates[] = new Delegate(function($reason = null) use ($rejected, $deferred) { |
|
| 127 | 127 | if ($rejected !== null) { |
| 128 | 128 | $rejected($reason); |
| 129 | 129 | } |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function always(callable $finally, callable $notify = null) |
| 162 | 162 | { |
| 163 | - return $this->then(function ($value) use ($finally) { |
|
| 163 | + return $this->then(function($value) use ($finally) { |
|
| 164 | 164 | $finally($value, null); |
| 165 | 165 | |
| 166 | 166 | return $value; |
| 167 | - }, function ($reason) use ($finally) { |
|
| 167 | + }, function($reason) use ($finally) { |
|
| 168 | 168 | $finally(null, $reason); |
| 169 | 169 | }, $notify); |
| 170 | 170 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $this |
| 59 | 59 | ->getAssertionManager() |
| 60 | - ->setHandler('delegateCall', function (MockAggregator $mock) { |
|
| 60 | + ->setHandler('delegateCall', function(MockAggregator $mock) { |
|
| 61 | 61 | return $this->delegateCall($mock); |
| 62 | 62 | }) |
| 63 | 63 | ; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $rejected = $this->delegateMock(), |
| 112 | 112 | $notify = $this->delegateMock() |
| 113 | 113 | ) |
| 114 | - ->when(function () use ($promise, $succeed, $rejected, $notify) { |
|
| 114 | + ->when(function() use ($promise, $succeed, $rejected, $notify) { |
|
| 115 | 115 | $promise->then($succeed, $rejected, $notify); |
| 116 | 116 | $this->resolve('foo'); |
| 117 | 117 | }) |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $notify = $this->delegateMock(), |
| 134 | 134 | $reason = new \Exception() |
| 135 | 135 | ) |
| 136 | - ->when(function () use ($promise, $succeed, $rejected, $notify, $reason) { |
|
| 136 | + ->when(function() use ($promise, $succeed, $rejected, $notify, $reason) { |
|
| 137 | 137 | $promise->then($succeed, $rejected, $notify); |
| 138 | 138 | $this->reject($reason); |
| 139 | 139 | }) |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $rejected = $this->delegateMock(), |
| 155 | 155 | $notify = $this->delegateMock() |
| 156 | 156 | ) |
| 157 | - ->when(function () use ($promise, $succeed, $rejected, $notify) { |
|
| 157 | + ->when(function() use ($promise, $succeed, $rejected, $notify) { |
|
| 158 | 158 | $promise->then($succeed, $rejected, $notify); |
| 159 | 159 | for ($i = 0; $i < 10; ++$i) { |
| 160 | 160 | $this->notify(($i + 1) * 10); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $succeedThen = $this->delegateMock() |
| 179 | 179 | ) |
| 180 | 180 | ->let($promiseThen = $promise->then($succeed, $rejected, $notify)) |
| 181 | - ->when(function () use ($promiseThen, $succeedThen) { |
|
| 181 | + ->when(function() use ($promiseThen, $succeedThen) { |
|
| 182 | 182 | $promiseThen->then($succeedThen); |
| 183 | 183 | $this->resolve('foo'); |
| 184 | 184 | }) |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | ->then() |
| 300 | 300 | ->delegateCall($otherwise) |
| 301 | 301 | ->with() |
| 302 | - ->arguments(0, function ($argument) { |
|
| 302 | + ->arguments(0, function($argument) { |
|
| 303 | 303 | $this->object($argument)->isInstanceOf(\RuntimeException::class); |
| 304 | 304 | }) |
| 305 | 305 | ->once() |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | public function testResolvedPromise() |
| 333 | 333 | { |
| 334 | - $this->resolvedRejectedPromiseTest(function () { |
|
| 334 | + $this->resolvedRejectedPromiseTest(function() { |
|
| 335 | 335 | $this->resolve(); |
| 336 | 336 | }); |
| 337 | 337 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | public function testRejectedPromise() |
| 343 | 343 | { |
| 344 | - $this->resolvedRejectedPromiseTest(function () { |
|
| 344 | + $this->resolvedRejectedPromiseTest(function() { |
|
| 345 | 345 | $this->reject(new \Exception()); |
| 346 | 346 | }); |
| 347 | 347 | } |
@@ -355,13 +355,13 @@ discard block |
||
| 355 | 355 | ->if($this->promise()) |
| 356 | 356 | ->when($when) |
| 357 | 357 | ->then() |
| 358 | - ->exception(function () { |
|
| 358 | + ->exception(function() { |
|
| 359 | 359 | $this->resolve(); |
| 360 | 360 | })->isInstanceOf(\LogicException::class) |
| 361 | - ->exception(function () { |
|
| 361 | + ->exception(function() { |
|
| 362 | 362 | $this->reject(); |
| 363 | 363 | })->isInstanceOf(\LogicException::class) |
| 364 | - ->exception(function () { |
|
| 364 | + ->exception(function() { |
|
| 365 | 365 | $this->notify(); |
| 366 | 366 | })->isInstanceOf(\LogicException::class) |
| 367 | 367 | ; |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | { |
| 375 | 375 | $mockName = '\mock\Cubiche\Core\Delegate\Delegate'; |
| 376 | 376 | |
| 377 | - return new $mockName(function ($value = null) use ($return) { |
|
| 377 | + return new $mockName(function($value = null) use ($return) { |
|
| 378 | 378 | return $return === null ? $value : $return; |
| 379 | 379 | }); |
| 380 | 380 | } |