@@ -367,6 +367,10 @@ |
||
367 | 367 | return $file; |
368 | 368 | } |
369 | 369 | |
370 | + /** |
|
371 | + * @param string $class |
|
372 | + * @param string $ext |
|
373 | + */ |
|
370 | 374 | private function findFileWithExtension($class, $ext) |
371 | 375 | { |
372 | 376 | // PSR-4 lookup |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | return false; |
343 | 343 | } |
344 | 344 | if (null !== $this->apcuPrefix) { |
345 | - $file = apcu_fetch($this->apcuPrefix.$class, $hit); |
|
345 | + $file = apcu_fetch($this->apcuPrefix . $class, $hit); |
|
346 | 346 | if ($hit) { |
347 | 347 | return $file; |
348 | 348 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | if (null !== $this->apcuPrefix) { |
359 | - apcu_add($this->apcuPrefix.$class, $file); |
|
359 | + apcu_add($this->apcuPrefix . $class, $file); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | if (false === $file) { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath.'\\'; |
|
380 | + $search = $subPath . '\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | 382 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
383 | 383 | $length = $this->prefixLengthsPsr4[$first][$search]; |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use GuzzleHttp\Promise as P; |
5 | 5 | use GuzzleHttp\Promise\Promise; |
6 | -use GuzzleHttp\Psr7; |
|
7 | 6 | use Psr\Http\Message\RequestInterface; |
8 | 7 | |
9 | 8 | /** |
@@ -65,7 +65,7 @@ |
||
65 | 65 | |
66 | 66 | $promise = new Promise( |
67 | 67 | [$this, 'execute'], |
68 | - function () use ($id) { return $this->cancel($id); } |
|
68 | + function() use ($id) { return $this->cancel($id); } |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | $this->addRequest(['easy' => $easy, 'deferred' => $promise]); |
@@ -71,6 +71,9 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | + /** |
|
75 | + * @param RequestException $error |
|
76 | + */ |
|
74 | 77 | private function invokeStats( |
75 | 78 | array $options, |
76 | 79 | RequestInterface $request, |
@@ -90,6 +93,10 @@ discard block |
||
90 | 93 | } |
91 | 94 | } |
92 | 95 | |
96 | + /** |
|
97 | + * @param resource $stream |
|
98 | + * @param double|null $startTime |
|
99 | + */ |
|
93 | 100 | private function createResponse( |
94 | 101 | RequestInterface $request, |
95 | 102 | array $options, |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | private function createResource(callable $callback) |
231 | 231 | { |
232 | 232 | $errors = null; |
233 | - set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { |
|
233 | + set_error_handler(function($_, $msg, $file, $line) use (&$errors) { |
|
234 | 234 | $errors[] = [ |
235 | 235 | 'message' => $msg, |
236 | 236 | 'file' => $file, |
@@ -302,13 +302,13 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | $context = $this->createResource( |
305 | - function () use ($context, $params) { |
|
305 | + function() use ($context, $params) { |
|
306 | 306 | return stream_context_create($context, $params); |
307 | 307 | } |
308 | 308 | ); |
309 | 309 | |
310 | 310 | return $this->createResource( |
311 | - function () use ($request, &$http_response_header, $context) { |
|
311 | + function() use ($request, &$http_response_header, $context) { |
|
312 | 312 | $resource = fopen((string) $request->getUri()->withFragment(''), 'r', null, $context); |
313 | 313 | $this->lastHeaders = $http_response_header; |
314 | 314 | return $resource; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | { |
421 | 421 | $this->addNotification( |
422 | 422 | $params, |
423 | - function ($code, $a, $b, $c, $transferred, $total) use ($value) { |
|
423 | + function($code, $a, $b, $c, $transferred, $total) use ($value) { |
|
424 | 424 | if ($code == STREAM_NOTIFY_PROGRESS) { |
425 | 425 | $value($total, $transferred, null, null); |
426 | 426 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); |
454 | 454 | $this->addNotification( |
455 | 455 | $params, |
456 | - function () use ($ident, $value, $map, $args) { |
|
456 | + function() use ($ident, $value, $map, $args) { |
|
457 | 457 | $passed = func_get_args(); |
458 | 458 | $code = array_shift($passed); |
459 | 459 | fprintf($value, '<%s> [%s] ', $ident, $map[$code]); |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | |
481 | 481 | private function callArray(array $functions) |
482 | 482 | { |
483 | - return function () use ($functions) { |
|
483 | + return function() use ($functions) { |
|
484 | 484 | $args = func_get_args(); |
485 | 485 | foreach ($functions as $fn) { |
486 | 486 | call_user_func_array($fn, $args); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * @param RequestInterface $request |
76 | 76 | * @param array $options |
77 | - * @param ResponseInterface|PromiseInterface $response |
|
77 | + * @param ResponseInterface $response |
|
78 | 78 | * |
79 | 79 | * @return ResponseInterface|PromiseInterface |
80 | 80 | */ |
@@ -115,6 +115,9 @@ discard block |
||
115 | 115 | return $promise; |
116 | 116 | } |
117 | 117 | |
118 | + /** |
|
119 | + * @param string $uri |
|
120 | + */ |
|
118 | 121 | private function withTracking(PromiseInterface $promise, $uri) |
119 | 122 | { |
120 | 123 | return $promise->then( |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | return $fn($request, $options) |
69 | - ->then(function (ResponseInterface $response) use ($request, $options) { |
|
69 | + ->then(function(ResponseInterface $response) use ($request, $options) { |
|
70 | 70 | return $this->checkRedirect($request, $options, $response); |
71 | 71 | }); |
72 | 72 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | private function withTracking(PromiseInterface $promise, $uri) |
119 | 119 | { |
120 | 120 | return $promise->then( |
121 | - function (ResponseInterface $response) use ($uri) { |
|
121 | + function(ResponseInterface $response) use ($uri) { |
|
122 | 122 | // Note that we are pushing to the front of the list as this |
123 | 123 | // would be an earlier response than what is currently present |
124 | 124 | // in the history header. |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use GuzzleHttp\Promise\PromiseInterface; |
5 | 5 | use GuzzleHttp\Promise\RejectedPromise; |
6 | -use GuzzleHttp\Psr7; |
|
7 | 6 | use Psr\Http\Message\RequestInterface; |
8 | 7 | use Psr\Http\Message\ResponseInterface; |
9 | 8 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | private function onFulfilled(RequestInterface $req, array $options) |
75 | 75 | { |
76 | - return function ($value) use ($req, $options) { |
|
76 | + return function($value) use ($req, $options) { |
|
77 | 77 | if (!call_user_func( |
78 | 78 | $this->decider, |
79 | 79 | $options['retries'], |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | private function onRejected(RequestInterface $req, array $options) |
91 | 91 | { |
92 | - return function ($reason) use ($req, $options) { |
|
92 | + return function($reason) use ($req, $options) { |
|
93 | 93 | if (!call_user_func( |
94 | 94 | $this->decider, |
95 | 95 | $options['retries'], |
@@ -35,6 +35,9 @@ |
||
35 | 35 | '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', |
36 | 36 | '%3B', '%3D']; |
37 | 37 | |
38 | + /** |
|
39 | + * @param string $template |
|
40 | + */ |
|
38 | 41 | public function expand($template, array $variables) |
39 | 42 | { |
40 | 43 | if (false === strpos($template, '{')) { |
@@ -16,8 +16,8 @@ |
||
16 | 16 | |
17 | 17 | /** @var array Hash for quick operator lookups */ |
18 | 18 | private static $operatorHash = [ |
19 | - '' => ['prefix' => '', 'joiner' => ',', 'query' => false], |
|
20 | - '+' => ['prefix' => '', 'joiner' => ',', 'query' => false], |
|
19 | + '' => ['prefix' => '', 'joiner' => ',', 'query' => false], |
|
20 | + '+' => ['prefix' => '', 'joiner' => ',', 'query' => false], |
|
21 | 21 | '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false], |
22 | 22 | '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false], |
23 | 23 | '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false], |
@@ -118,6 +118,9 @@ discard block |
||
118 | 118 | $this->settle(self::REJECTED, $reason); |
119 | 119 | } |
120 | 120 | |
121 | + /** |
|
122 | + * @param string $state |
|
123 | + */ |
|
121 | 124 | private function settle($state, $value) |
122 | 125 | { |
123 | 126 | if ($this->state !== self::PENDING) { |
@@ -164,11 +167,19 @@ discard block |
||
164 | 167 | } else { |
165 | 168 | // Resolve the handlers when the forwarded promise is resolved. |
166 | 169 | $value->then( |
170 | + |
|
171 | + /** |
|
172 | + * @param string $value |
|
173 | + */ |
|
167 | 174 | static function ($value) use ($handlers) { |
168 | 175 | foreach ($handlers as $handler) { |
169 | 176 | self::callHandler(1, $value, $handler); |
170 | 177 | } |
171 | 178 | }, |
179 | + |
|
180 | + /** |
|
181 | + * @param string $reason |
|
182 | + */ |
|
172 | 183 | static function ($reason) use ($handlers) { |
173 | 184 | foreach ($handlers as $handler) { |
174 | 185 | self::callHandler(2, $reason, $handler); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | if (!method_exists($value, 'then')) { |
152 | 152 | $id = $state === self::FULFILLED ? 1 : 2; |
153 | 153 | // It's a success, so resolve the handlers in the queue. |
154 | - queue()->add(static function () use ($id, $value, $handlers) { |
|
154 | + queue()->add(static function() use ($id, $value, $handlers) { |
|
155 | 155 | foreach ($handlers as $handler) { |
156 | 156 | self::callHandler($id, $value, $handler); |
157 | 157 | } |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | } else { |
165 | 165 | // Resolve the handlers when the forwarded promise is resolved. |
166 | 166 | $value->then( |
167 | - static function ($value) use ($handlers) { |
|
167 | + static function($value) use ($handlers) { |
|
168 | 168 | foreach ($handlers as $handler) { |
169 | 169 | self::callHandler(1, $value, $handler); |
170 | 170 | } |
171 | 171 | }, |
172 | - static function ($reason) use ($handlers) { |
|
172 | + static function($reason) use ($handlers) { |
|
173 | 173 | foreach ($handlers as $handler) { |
174 | 174 | self::callHandler(2, $reason, $handler); |
175 | 175 | } |
@@ -148,6 +148,9 @@ |
||
148 | 148 | return isset($this->metadata[$key]) ? $this->metadata[$key] : null; |
149 | 149 | } |
150 | 150 | |
151 | + /** |
|
152 | + * @param integer $length |
|
153 | + */ |
|
151 | 154 | private function pump($length) |
152 | 155 | { |
153 | 156 | if ($this->source) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
142 | - * @param mixed $param |
|
142 | + * @param string|null $param |
|
143 | 143 | * @return boolean |
144 | 144 | */ |
145 | 145 | private function isStringOrNull($param) |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | - * @param mixed $param |
|
151 | + * @param string $param |
|
152 | 152 | * @return boolean |
153 | 153 | */ |
154 | 154 | private function isStringNotEmpty($param) |