@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | /** @var \Cubiche\Core\Async\Promise\PromiseInterface $promise */ |
78 | 78 | foreach ($promises as $key => $promise) { |
79 | 79 | $promise->then( |
80 | - function ($value) use ($deferred, &$results, $map, $key, &$pending) { |
|
80 | + function($value) use ($deferred, &$results, $map, $key, &$pending) { |
|
81 | 81 | if ($map !== null) { |
82 | 82 | $value = $map($value); |
83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $deferred->resolve($results); |
88 | 88 | } |
89 | 89 | }, |
90 | - function ($reason) use ($deferred) { |
|
90 | + function($reason) use ($deferred) { |
|
91 | 91 | $deferred->reject($reason); |
92 | 92 | } |
93 | 93 | ); |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | public static function timeout(PromiseInterface $promise, $time, LoopInterface $loop) |
107 | 107 | { |
108 | 108 | $deferred = self::defer(); |
109 | - $timer = $loop->timeout(function () use ($promise, $deferred, $time) { |
|
109 | + $timer = $loop->timeout(function() use ($promise, $deferred, $time) { |
|
110 | 110 | $deferred->reject(new TimeoutException($time)); |
111 | 111 | }, $time); |
112 | 112 | |
113 | - $promise->then(function ($value = null) use ($deferred, $timer) { |
|
113 | + $promise->then(function($value = null) use ($deferred, $timer) { |
|
114 | 114 | $timer->cancel(); |
115 | 115 | $deferred->resolve($value); |
116 | - }, function ($reason = null) use ($deferred, $timer) { |
|
116 | + }, function($reason = null) use ($deferred, $timer) { |
|
117 | 117 | $timer->cancel(); |
118 | 118 | $deferred->reject($reason); |
119 | 119 | }); |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | $promise = self::timeout($promise, $timeout, $loop); |
139 | 139 | } |
140 | 140 | |
141 | - $promise->then(function ($value = null) use (&$result) { |
|
141 | + $promise->then(function($value = null) use (&$result) { |
|
142 | 142 | $result = $value; |
143 | - }, function ($reason = null) use (&$rejectionReason) { |
|
143 | + }, function($reason = null) use (&$rejectionReason) { |
|
144 | 144 | $rejectionReason = $reason; |
145 | - })->always(function () use ($loop) { |
|
145 | + })->always(function() use ($loop) { |
|
146 | 146 | $loop->stop(); |
147 | 147 | }); |
148 | 148 |
@@ -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 | } |
@@ -31,11 +31,11 @@ |
||
31 | 31 | */ |
32 | 32 | public function always(callable $finally, callable $onNotify = null) |
33 | 33 | { |
34 | - return $this->then(function ($value) use ($finally) { |
|
34 | + return $this->then(function($value) use ($finally) { |
|
35 | 35 | $finally($value, null); |
36 | 36 | |
37 | 37 | return $value; |
38 | - }, function ($reason) use ($finally) { |
|
38 | + }, function($reason) use ($finally) { |
|
39 | 39 | $finally(null, $reason); |
40 | 40 | }, $onNotify); |
41 | 41 | } |
@@ -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 | }) |