@@ -5,7 +5,6 @@ |
||
5 | 5 | use mpyw\Co\Internal\CoOption; |
6 | 6 | use mpyw\Co\Internal\GeneratorContainer; |
7 | 7 | use mpyw\Co\Internal\CURLPool; |
8 | - |
|
9 | 8 | use React\Promise\Deferred; |
10 | 9 | use React\Promise\PromiseInterface; |
11 | 10 | use function React\Promise\all; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $deferred = new Deferred; |
111 | 111 | // For convenience, all values are wrapped into generator |
112 | - $genfunc = function () use ($throw, $value, &$return) { |
|
112 | + $genfunc = function() use ($throw, $value, &$return) { |
|
113 | 113 | try { |
114 | 114 | if ($throw !== null) { |
115 | 115 | $key = $throw ? null : CoInterface::SAFE; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | if ($gc->key() === CoInterface::DELAY) { |
166 | 166 | $dfd = new Deferred; |
167 | 167 | $this->pool->addDelay($gc->current(), $dfd); |
168 | - $dfd->promise()->then(function () use ($gc) { |
|
168 | + $dfd->promise()->then(function() use ($gc) { |
|
169 | 169 | $gc->send(null); |
170 | - })->always(function () use ($gc, $deferred) { |
|
170 | + })->always(function() use ($gc, $deferred) { |
|
171 | 171 | $this->processGeneratorContainer($gc, $deferred); |
172 | 172 | }); |
173 | 173 | return; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $this->promiseAll($yieldables, $gc->key() !== CoInterface::SAFE)->then( |
189 | 189 | self::getApplier($yielded, $yieldables, [$gc, 'send']), |
190 | 190 | [$gc, 'throw_'] |
191 | - )->always(function () use ($gc, $deferred) { |
|
191 | + )->always(function() use ($gc, $deferred) { |
|
192 | 192 | // Continue |
193 | 193 | $this->processGeneratorContainer($gc, $deferred); |
194 | 194 | }); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | private static function getApplier($yielded, $yieldables, callable $next) |
204 | 204 | { |
205 | - return function (array $results) use ($yielded, $yieldables, $next) { |
|
205 | + return function(array $results) use ($yielded, $yieldables, $next) { |
|
206 | 206 | foreach ($results as $hash => $resolved) { |
207 | 207 | $current = &$yielded; |
208 | 208 | foreach ($yieldables[$hash]['keylist'] as $key) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | if (!$throw_acceptable) { |
233 | 233 | $original_dfd = $dfd; |
234 | 234 | $dfd = new Deferred; |
235 | - $absorber = function ($any) use ($original_dfd) { |
|
235 | + $absorber = function($any) use ($original_dfd) { |
|
236 | 236 | $original_dfd->resolve($any); |
237 | 237 | }; |
238 | 238 | $dfd->promise()->then($absorber, $absorber); |
@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | $errno = curl_multi_add_handle($this->mh, $ch); |
70 | 70 | if ($errno !== CURLM_OK) { |
71 | - $msg = curl_multi_strerror($errno) . ": $ch"; |
|
71 | + $msg = curl_multi_strerror($errno).": $ch"; |
|
72 | 72 | $deferred->reject(new \RuntimeException($msg)); |
73 | 73 | return; |
74 | 74 | } |
@@ -150,6 +150,7 @@ |
||
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Used for halting loop. |
153 | + * @param \RuntimeException $e |
|
153 | 154 | */ |
154 | 155 | public function reserveHaltException($e) |
155 | 156 | { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function offsetGet($offset) |
89 | 89 | { |
90 | 90 | if (!isset($this->options[$offset])) { |
91 | - throw new \DomainException('Undefined field: ' + $offset); |
|
91 | + throw new \DomainException('Undefined field: ' +$offset); |
|
92 | 92 | } |
93 | 93 | return $this->options[$offset]; |
94 | 94 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | if (!isset(self::$types[$key])) { |
126 | 126 | throw new \InvalidArgumentException("Unknown option: $key"); |
127 | 127 | } |
128 | - $validator = [__CLASS__, 'validate' . self::$types[$key]]; |
|
128 | + $validator = [__CLASS__, 'validate'.self::$types[$key]]; |
|
129 | 129 | $options[$key] = $validator($key, $value); |
130 | 130 | } |
131 | 131 | return $options; |