@@ -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; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | if (!self::$self) { |
82 | 82 | throw new \BadMethodCallException( |
83 | - 'Co::async() must be called along with Co::wait(). ' . |
|
83 | + 'Co::async() must be called along with Co::wait(). '. |
|
84 | 84 | 'This method is mainly expected to be used in CURLOPT_WRITEFUNCTION callback.' |
85 | 85 | ); |
86 | 86 | } |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | $return = $exception = null; |
104 | 104 | $deferred = new Deferred; |
105 | 105 | $deferred->promise()->then( |
106 | - function ($r) use (&$return) { |
|
106 | + function($r) use (&$return) { |
|
107 | 107 | $return = $r; |
108 | 108 | }, |
109 | - function ($e) use (&$exception) { |
|
109 | + function($e) use (&$exception) { |
|
110 | 110 | $exception = $e; |
111 | 111 | } |
112 | 112 | ); |
113 | 113 | // For convenience, all values are wrapped into generator |
114 | - $genfunc = function () use ($value) { |
|
114 | + $genfunc = function() use ($value) { |
|
115 | 115 | yield CoInterface::RETURN_WITH => (yield $value); |
116 | 116 | }; |
117 | 117 | $con = Utils::normalize($genfunc, $this->options); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $this->promiseAll($yieldables, $gc->throwAcceptable())->then( |
190 | 190 | self::getApplier($yielded, $yieldables, [$gc, 'send']), |
191 | 191 | [$gc, 'throw_'] |
192 | - )->always(function () use ($gc, $deferred) { |
|
192 | + )->always(function() use ($gc, $deferred) { |
|
193 | 193 | // Continue |
194 | 194 | $this->processGeneratorContainer($gc, $deferred); |
195 | 195 | }); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | private static function getApplier($yielded, $yieldables, callable $next) |
205 | 205 | { |
206 | - return function (array $results) use ($yielded, $yieldables, $next) { |
|
206 | + return function(array $results) use ($yielded, $yieldables, $next) { |
|
207 | 207 | foreach ($results as $hash => $resolved) { |
208 | 208 | $current = &$yielded; |
209 | 209 | 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); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Constructor. |
35 | - * @param Generator $g |
|
35 | + * @param \Generator $g |
|
36 | 36 | * @param CoOption $options |
37 | 37 | * @param mixed $yield_key |
38 | 38 | */ |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Throw exception into generator. |
127 | - * @param RuntimeException $e |
|
127 | + * @param \RuntimeException $e |
|
128 | 128 | * @NOTE: This method returns nothing, |
129 | 129 | * while original generator returns something. |
130 | 130 | */ |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function offsetGet($offset) |
88 | 88 | { |
89 | 89 | if (!isset($this->options[$offset])) { |
90 | - throw new \DomainException('Undefined field: ' + $offset); |
|
90 | + throw new \DomainException('Undefined field: ' +$offset); |
|
91 | 91 | } |
92 | 92 | return $this->options[$offset]; |
93 | 93 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if (!isset(self::TYPES[$key])) { |
125 | 125 | throw new \InvalidArgumentException("Unknown option: $key"); |
126 | 126 | } |
127 | - $validator = [__CLASS__, 'validate' . self::TYPES[$key]]; |
|
127 | + $validator = [__CLASS__, 'validate'.self::TYPES[$key]]; |
|
128 | 128 | $options[$key] = $validator($key, $value); |
129 | 129 | } |
130 | 130 | return $options; |
@@ -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 | } |