@@ -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; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | if (!self::$self) { |
| 84 | 84 | throw new \BadMethodCallException( |
| 85 | - 'Co::async() must be called along with Co::wait(). ' . |
|
| 85 | + 'Co::async() must be called along with Co::wait(). '. |
|
| 86 | 86 | 'This method is mainly expected to be used in CURLOPT_WRITEFUNCTION callback.' |
| 87 | 87 | ); |
| 88 | 88 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $deferred = new Deferred; |
| 106 | 106 | // For convenience, all values are wrapped into generator |
| 107 | - $genfunc = function () use ($value, &$return) { |
|
| 107 | + $genfunc = function() use ($value, &$return) { |
|
| 108 | 108 | try { |
| 109 | 109 | $return = (yield $value); |
| 110 | 110 | } catch (\RuntimeException $e) { |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | if ($gc->key() === CoInterface::DELAY) { |
| 156 | 156 | $dfd = new Deferred; |
| 157 | 157 | $this->pool->addDelay($gc->current(), $dfd); |
| 158 | - $dfd->promise()->then(function () use ($gc) { |
|
| 158 | + $dfd->promise()->then(function() use ($gc) { |
|
| 159 | 159 | $gc->send(null); |
| 160 | - })->always(function () use ($gc, $deferred) { |
|
| 160 | + })->always(function() use ($gc, $deferred) { |
|
| 161 | 161 | $this->processGeneratorContainer($gc, $deferred); |
| 162 | 162 | }); |
| 163 | 163 | return; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $this->promiseAll($yieldables, $gc->throwAcceptable())->then( |
| 179 | 179 | self::getApplier($yielded, $yieldables, [$gc, 'send']), |
| 180 | 180 | [$gc, 'throw_'] |
| 181 | - )->always(function () use ($gc, $deferred) { |
|
| 181 | + )->always(function() use ($gc, $deferred) { |
|
| 182 | 182 | // Continue |
| 183 | 183 | $this->processGeneratorContainer($gc, $deferred); |
| 184 | 184 | }); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | private static function getApplier($yielded, $yieldables, callable $next) |
| 194 | 194 | { |
| 195 | - return function (array $results) use ($yielded, $yieldables, $next) { |
|
| 195 | + return function(array $results) use ($yielded, $yieldables, $next) { |
|
| 196 | 196 | foreach ($results as $hash => $resolved) { |
| 197 | 197 | $current = &$yielded; |
| 198 | 198 | foreach ($yieldables[$hash]['keylist'] as $key) { |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if (!$throw_acceptable) { |
| 223 | 223 | $original_dfd = $dfd; |
| 224 | 224 | $dfd = new Deferred; |
| 225 | - $absorber = function ($any) use ($original_dfd) { |
|
| 225 | + $absorber = function($any) use ($original_dfd) { |
|
| 226 | 226 | $original_dfd->resolve($any); |
| 227 | 227 | }; |
| 228 | 228 | $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 | } |
@@ -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; |