@@ -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; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | if (!self::$self) { |
80 | 80 | throw new \BadMethodCallException( |
81 | - 'Co::async() must be called along with Co::wait(). ' . |
|
81 | + 'Co::async() must be called along with Co::wait(). '. |
|
82 | 82 | 'This method is mainly expected to be used in CURLOPT_WRITEFUNCTION callback.' |
83 | 83 | ); |
84 | 84 | } |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | // If $wait, final result is stored into referenced $return |
105 | 105 | if ($wait) { |
106 | 106 | $deferred = new Deferred; |
107 | - $deferred->promise()->done(function ($r) use (&$return) { |
|
107 | + $deferred->promise()->done(function($r) use (&$return) { |
|
108 | 108 | $return = $r; |
109 | 109 | }); |
110 | 110 | } |
111 | 111 | // For convenience, all values are wrapped into generator |
112 | - $genfunc = function () use ($value) { |
|
112 | + $genfunc = function() use ($value) { |
|
113 | 113 | yield CoInterface::RETURN_WITH => (yield $value); |
114 | 114 | }; |
115 | 115 | $con = Utils::normalize($genfunc, $options); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->promiseAll($yieldables, $gc->throwAcceptable())->then( |
185 | 185 | self::getApplier($yielded, $yieldables, [$gc, 'send']), |
186 | 186 | [$gc, 'throw_'] |
187 | - )->always(function () use ($gc, $deferred) { |
|
187 | + )->always(function() use ($gc, $deferred) { |
|
188 | 188 | // Continue |
189 | 189 | $this->processGeneratorContainer($gc, $deferred); |
190 | 190 | }); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | private static function getApplier($yielded, $yieldables, callable $next) |
200 | 200 | { |
201 | - return function (array $results) use ($yielded, $yieldables, $next) { |
|
201 | + return function(array $results) use ($yielded, $yieldables, $next) { |
|
202 | 202 | foreach ($results as $hash => $resolved) { |
203 | 203 | $current = &$yielded; |
204 | 204 | foreach ($yieldables[$hash]['keylist'] as $key) { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | if (!$throw_acceptable) { |
228 | 228 | $original_dfd = $dfd; |
229 | 229 | $dfd = new Deferred; |
230 | - $absorber = function ($any) use ($original_dfd) { |
|
230 | + $absorber = function($any) use ($original_dfd) { |
|
231 | 231 | $original_dfd->resolve($any); |
232 | 232 | }; |
233 | 233 | $dfd->promise()->then($absorber, $absorber); |
@@ -44,7 +44,6 @@ |
||
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Get default options. |
47 | - * @param array $options |
|
48 | 47 | */ |
49 | 48 | public static function getDefault() |
50 | 49 | { |
@@ -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; |
@@ -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 | */ |
@@ -66,7 +66,7 @@ |
||
66 | 66 | } else { |
67 | 67 | $errno = curl_multi_add_handle($this->mh, $ch); |
68 | 68 | if ($errno !== CURLM_OK) { |
69 | - $msg = curl_multi_strerror($errno) . ": $ch"; |
|
69 | + $msg = curl_multi_strerror($errno).": $ch"; |
|
70 | 70 | $class = $errno === 7 ? '\InvalidArgumentException' : '\RuntimeException'; |
71 | 71 | throw new $class($msg); |
72 | 72 | } |