@@ -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 | } |
@@ -55,13 +55,13 @@ |
||
55 | 55 | { |
56 | 56 | if ($this->promise === null) { |
57 | 57 | $this->promise = new Promise( |
58 | - new Delegate(function (callable $callable) { |
|
58 | + new Delegate(function(callable $callable) { |
|
59 | 59 | $this->resolveDelegate = new Delegate($callable); |
60 | 60 | }), |
61 | - new Delegate(function (callable $callable) { |
|
61 | + new Delegate(function(callable $callable) { |
|
62 | 62 | $this->rejectDelegate = new Delegate($callable); |
63 | 63 | }), |
64 | - new Delegate(function (callable $callable) { |
|
64 | + new Delegate(function(callable $callable) { |
|
65 | 65 | $this->notifyDelegate = new Delegate($callable); |
66 | 66 | }) |
67 | 67 | ); |
@@ -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 | ; |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | { |
28 | 28 | return array( |
29 | 29 | new Deferred(), |
30 | - function () { |
|
30 | + function() { |
|
31 | 31 | }, |
32 | - function () { |
|
32 | + function() { |
|
33 | 33 | }, |
34 | - function () { |
|
34 | + function() { |
|
35 | 35 | }, |
36 | 36 | ); |
37 | 37 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function testConstruct() |
43 | 43 | { |
44 | 44 | $this |
45 | - ->exception(function () { |
|
45 | + ->exception(function() { |
|
46 | 46 | $deferred = new Deferred(); |
47 | 47 | $deferred->resolve(); |
48 | 48 | $this->newTestedInstance($deferred); |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | $deferred = $this->newTestedInstance( |
67 | 67 | new Deferred(), |
68 | 68 | null, |
69 | - function () use ($reason) { |
|
69 | + function() use ($reason) { |
|
70 | 70 | throw $reason; |
71 | 71 | } |
72 | 72 | ) |
73 | 73 | ) |
74 | - ->when(function () use ($deferred, $onRejected) { |
|
74 | + ->when(function() use ($deferred, $onRejected) { |
|
75 | 75 | $deferred->promise()->then(null, $onRejected); |
76 | 76 | $deferred->reject('foo'); |
77 | 77 | }) |
@@ -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 | /** |
@@ -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 | } |