@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | : \GuzzleHttp\Promise\promise_for($response); |
83 | 83 | |
84 | 84 | return $response->then( |
85 | - function ($value) use ($request, $options) { |
|
85 | + function($value) use ($request, $options) { |
|
86 | 86 | $this->invokeStats($request, $options, $value); |
87 | 87 | if ($this->onFulfilled) { |
88 | 88 | call_user_func($this->onFulfilled, $value); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | return $value; |
104 | 104 | }, |
105 | - function ($reason) use ($request, $options) { |
|
105 | + function($reason) use ($request, $options) { |
|
106 | 106 | $this->invokeStats($request, $options, null, $reason); |
107 | 107 | if ($this->onRejected) { |
108 | 108 | call_user_func($this->onRejected, $reason); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | if ($body->isSeekable()) { |
269 | 269 | $body->rewind(); |
270 | 270 | } |
271 | - $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { |
|
271 | + $conf[CURLOPT_READFUNCTION] = function($ch, $fd, $length) use ($body) { |
|
272 | 272 | return $body->read($length); |
273 | 273 | }; |
274 | 274 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $sink = new LazyOpenStream($sink, 'w+'); |
363 | 363 | } |
364 | 364 | $easy->sink = $sink; |
365 | - $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use ($sink) { |
|
365 | + $conf[CURLOPT_WRITEFUNCTION] = function($ch, $write) use ($sink) { |
|
366 | 366 | return $sink->write($write); |
367 | 367 | }; |
368 | 368 | } else { |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | ); |
432 | 432 | } |
433 | 433 | $conf[CURLOPT_NOPROGRESS] = false; |
434 | - $conf[CURLOPT_PROGRESSFUNCTION] = function () use ($progress) { |
|
434 | + $conf[CURLOPT_PROGRESSFUNCTION] = function() use ($progress) { |
|
435 | 435 | $args = func_get_args(); |
436 | 436 | // PHP 5.5 pushed the handle onto the start of the args |
437 | 437 | if (is_resource($args[0])) { |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $onHeaders = null; |
506 | 506 | } |
507 | 507 | |
508 | - return function ($ch, $h) use ( |
|
508 | + return function($ch, $h) use ( |
|
509 | 509 | $onHeaders, |
510 | 510 | $easy, |
511 | 511 | &$startingResponse |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | callable $default, |
23 | 23 | callable $sync |
24 | 24 | ) { |
25 | - return function (RequestInterface $request, array $options) use ($default, $sync) { |
|
25 | + return function(RequestInterface $request, array $options) use ($default, $sync) { |
|
26 | 26 | return empty($options[RequestOptions::SYNCHRONOUS]) |
27 | 27 | ? $default($request, $options) |
28 | 28 | : $sync($request, $options); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | callable $default, |
47 | 47 | callable $streaming |
48 | 48 | ) { |
49 | - return function (RequestInterface $request, array $options) use ($default, $streaming) { |
|
49 | + return function(RequestInterface $request, array $options) use ($default, $streaming) { |
|
50 | 50 | return empty($options['stream']) |
51 | 51 | ? $default($request, $options) |
52 | 52 | : $streaming($request, $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); |
@@ -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]); |
@@ -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], |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | $iterable = \GuzzleHttp\Promise\iter_for($requests); |
54 | - $requests = function () use ($iterable, $client, $opts) { |
|
54 | + $requests = function() use ($iterable, $client, $opts) { |
|
55 | 55 | foreach ($iterable as $key => $rfn) { |
56 | 56 | if ($rfn instanceof RequestInterface) { |
57 | 57 | yield $key => $client->sendAsync($rfn, $opts); |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | private static function cmpCallback(array &$options, $name, array &$results) |
110 | 110 | { |
111 | 111 | if (!isset($options[$name])) { |
112 | - $options[$name] = function ($v, $k) use (&$results) { |
|
112 | + $options[$name] = function($v, $k) use (&$results) { |
|
113 | 113 | $results[$k] = $v; |
114 | 114 | }; |
115 | 115 | } else { |
116 | 116 | $currentFn = $options[$name]; |
117 | - $options[$name] = function ($v, $k) use (&$results, $currentFn) { |
|
117 | + $options[$name] = function($v, $k) use (&$results, $currentFn) { |
|
118 | 118 | $currentFn($v, $k); |
119 | 119 | $results[$k] = $v; |
120 | 120 | }; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if ($resource instanceof StreamInterface) { |
94 | 94 | return $resource; |
95 | 95 | } elseif ($resource instanceof \Iterator) { |
96 | - return new PumpStream(function () use ($resource) { |
|
96 | + return new PumpStream(function() use ($resource) { |
|
97 | 97 | if (!$resource->valid()) { |
98 | 98 | return false; |
99 | 99 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $standardPorts = ['http' => 80, 'https' => 443]; |
218 | 218 | $scheme = $changes['uri']->getScheme(); |
219 | 219 | if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { |
220 | - $changes['set_headers']['Host'] .= ':'.$port; |
|
220 | + $changes['set_headers']['Host'] .= ':' . $port; |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | function try_fopen($filename, $mode) |
296 | 296 | { |
297 | 297 | $ex = null; |
298 | - set_error_handler(function () use ($filename, $mode, &$ex) { |
|
298 | + set_error_handler(function() use ($filename, $mode, &$ex) { |
|
299 | 299 | $ex = new \RuntimeException(sprintf( |
300 | 300 | 'Unable to open %s using mode %s: %s', |
301 | 301 | $filename, |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | } |
531 | 531 | |
532 | 532 | if ($urlEncoding === true) { |
533 | - $decoder = function ($value) { |
|
533 | + $decoder = function($value) { |
|
534 | 534 | return rawurldecode(str_replace('+', ' ', $value)); |
535 | 535 | }; |
536 | 536 | } elseif ($urlEncoding == PHP_QUERY_RFC3986) { |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | } elseif ($urlEncoding == PHP_QUERY_RFC1738) { |
539 | 539 | $decoder = 'urldecode'; |
540 | 540 | } else { |
541 | - $decoder = function ($str) { return $str; }; |
|
541 | + $decoder = function($str) { return $str; }; |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | foreach (explode('&', $str) as $kvp) { |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | } |
579 | 579 | |
580 | 580 | if ($encoding === false) { |
581 | - $encoder = function ($str) { return $str; }; |
|
581 | + $encoder = function($str) { return $str; }; |
|
582 | 582 | } elseif ($encoding === PHP_QUERY_RFC3986) { |
583 | 583 | $encoder = 'rawurlencode'; |
584 | 584 | } elseif ($encoding === PHP_QUERY_RFC1738) { |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | */ |
795 | 795 | function _parse_request_uri($path, array $headers) |
796 | 796 | { |
797 | - $hostKey = array_filter(array_keys($headers), function ($k) { |
|
797 | + $hostKey = array_filter(array_keys($headers), function($k) { |
|
798 | 798 | return strtolower($k) === 'host'; |
799 | 799 | }); |
800 | 800 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | private $headers = []; |
13 | 13 | |
14 | 14 | /** @var array Map of lowercase header name => original name at registration */ |
15 | - private $headerNames = []; |
|
15 | + private $headerNames = []; |
|
16 | 16 | |
17 | 17 | /** @var string */ |
18 | 18 | private $protocol = '1.1'; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | private function trimHeaderValues(array $values) |
178 | 178 | { |
179 | - return array_map(function ($value) { |
|
179 | + return array_map(function($value) { |
|
180 | 180 | return trim($value, " \t"); |
181 | 181 | }, $values); |
182 | 182 | } |