@@ -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); |
@@ -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 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $uri .= $scheme . ':'; |
121 | 121 | } |
122 | 122 | |
123 | - if ($authority != ''|| $scheme === 'file') { |
|
123 | + if ($authority != '' || $scheme === 'file') { |
|
124 | 124 | $uri .= '//' . $authority; |
125 | 125 | } |
126 | 126 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | $decodedKey = rawurldecode($key); |
310 | - $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) { |
|
310 | + $result = array_filter(explode('&', $current), function($part) use ($decodedKey) { |
|
311 | 311 | return rawurldecode(explode('=', $part)[0]) !== $decodedKey; |
312 | 312 | }); |
313 | 313 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $result = []; |
338 | 338 | } else { |
339 | 339 | $decodedKey = rawurldecode($key); |
340 | - $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) { |
|
340 | + $result = array_filter(explode('&', $current), function($part) use ($decodedKey) { |
|
341 | 341 | return rawurldecode(explode('=', $part)[0]) !== $decodedKey; |
342 | 342 | }); |
343 | 343 | } |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', |
696 | 696 | E_USER_DEPRECATED |
697 | 697 | ); |
698 | - $this->path = '/'. $this->path; |
|
698 | + $this->path = '/' . $this->path; |
|
699 | 699 | //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); |
700 | 700 | } |
701 | 701 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | { |
182 | 182 | $regex = '/(?:%[A-Fa-f0-9]{2})++/'; |
183 | 183 | |
184 | - $callback = function (array $match) { |
|
184 | + $callback = function(array $match) { |
|
185 | 185 | return strtoupper($match[0]); |
186 | 186 | }; |
187 | 187 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; |
199 | 199 | |
200 | - $callback = function (array $match) { |
|
200 | + $callback = function(array $match) { |
|
201 | 201 | return rawurldecode($match[0]); |
202 | 202 | }; |
203 | 203 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function __construct($withShutdown = true) |
19 | 19 | { |
20 | 20 | if ($withShutdown) { |
21 | - register_shutdown_function(function () { |
|
21 | + register_shutdown_function(function() { |
|
22 | 22 | if ($this->enableShutdown) { |
23 | 23 | // Only run the tasks if an E_ERROR didn't occur. |
24 | 24 | $err = error_get_last(); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $queue = queue(); |
34 | 34 | $reason = $this->reason; |
35 | 35 | $p = new Promise([$queue, 'run']); |
36 | - $queue->add(static function () use ($p, $reason, $onRejected) { |
|
36 | + $queue->add(static function() use ($p, $reason, $onRejected) { |
|
37 | 37 | if ($p->getState() === self::PENDING) { |
38 | 38 | try { |
39 | 39 | // Return a resolved promise if onRejected does not throw. |
@@ -60,7 +60,7 @@ |
||
60 | 60 | public function __construct(callable $generatorFn) |
61 | 61 | { |
62 | 62 | $this->generator = $generatorFn(); |
63 | - $this->result = new Promise(function () { |
|
63 | + $this->result = new Promise(function() { |
|
64 | 64 | while (isset($this->currentPromise)) { |
65 | 65 | $this->currentPromise->wait(); |
66 | 66 | } |