@@ -85,7 +85,7 @@ |
||
85 | 85 | } elseif ($level === 5) { |
86 | 86 | $label = 'Server error'; |
87 | 87 | $className = ServerException::class; |
88 | - } else { |
|
88 | + }else { |
|
89 | 89 | $label = 'Unsuccessful request'; |
90 | 90 | $className = __CLASS__; |
91 | 91 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public static function wrapSync(callable $default, callable $sync): callable |
26 | 26 | { |
27 | - return static function (RequestInterface $request, array $options) use ($default, $sync): PromiseInterface { |
|
27 | + return static function(RequestInterface $request, array $options) use ($default, $sync): PromiseInterface { |
|
28 | 28 | return empty($options[RequestOptions::SYNCHRONOUS]) ? $default($request, $options) : $sync($request, $options); |
29 | 29 | }; |
30 | 30 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function wrapStreaming(callable $default, callable $streaming): callable |
46 | 46 | { |
47 | - return static function (RequestInterface $request, array $options) use ($default, $streaming): PromiseInterface { |
|
47 | + return static function(RequestInterface $request, array $options) use ($default, $streaming): PromiseInterface { |
|
48 | 48 | return empty($options['stream']) ? $default($request, $options) : $streaming($request, $options); |
49 | 49 | }; |
50 | 50 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | if (\count($this->handles) >= $this->maxHandles) { |
81 | 81 | \curl_close($resource); |
82 | - } else { |
|
82 | + }else { |
|
83 | 83 | // Remove all callback functions as they can hold onto references |
84 | 84 | // and are not cleaned up by curl_reset. Using curl_setopt_array |
85 | 85 | // does not work for some reason, so removing each one |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1; |
237 | 237 | } elseif ($version == 2.0) { |
238 | 238 | $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0; |
239 | - } else { |
|
239 | + }else { |
|
240 | 240 | $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0; |
241 | 241 | } |
242 | 242 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | // Don't duplicate the Content-Length header |
284 | 284 | $this->removeHeader('Content-Length', $conf); |
285 | 285 | $this->removeHeader('Transfer-Encoding', $conf); |
286 | - } else { |
|
286 | + }else { |
|
287 | 287 | $conf[\CURLOPT_UPLOAD] = true; |
288 | 288 | if ($size !== null) { |
289 | 289 | $conf[\CURLOPT_INFILESIZE] = $size; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | if ($body->isSeekable()) { |
294 | 294 | $body->rewind(); |
295 | 295 | } |
296 | - $conf[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body) { |
|
296 | + $conf[\CURLOPT_READFUNCTION] = static function($ch, $fd, $length) use ($body) { |
|
297 | 297 | return $body->read($length); |
298 | 298 | }; |
299 | 299 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | // cURL requires a special format for empty headers. |
319 | 319 | // See https://github.com/guzzle/guzzle/issues/1882 for more details. |
320 | 320 | $conf[\CURLOPT_HTTPHEADER][] = "$name;"; |
321 | - } else { |
|
321 | + }else { |
|
322 | 322 | $conf[\CURLOPT_HTTPHEADER][] = "$name: $value"; |
323 | 323 | } |
324 | 324 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | unset($conf[\CURLOPT_CAINFO]); |
355 | 355 | $conf[\CURLOPT_SSL_VERIFYHOST] = 0; |
356 | 356 | $conf[\CURLOPT_SSL_VERIFYPEER] = false; |
357 | - } else { |
|
357 | + }else { |
|
358 | 358 | $conf[\CURLOPT_SSL_VERIFYHOST] = 2; |
359 | 359 | $conf[\CURLOPT_SSL_VERIFYPEER] = true; |
360 | 360 | if (\is_string($options['verify'])) { |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | ) |
374 | 374 | ) { |
375 | 375 | $conf[\CURLOPT_CAPATH] = $options['verify']; |
376 | - } else { |
|
376 | + }else { |
|
377 | 377 | $conf[\CURLOPT_CAINFO] = $options['verify']; |
378 | 378 | } |
379 | 379 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $accept = $easy->request->getHeaderLine('Accept-Encoding'); |
385 | 385 | if ($accept) { |
386 | 386 | $conf[\CURLOPT_ENCODING] = $accept; |
387 | - } else { |
|
387 | + }else { |
|
388 | 388 | // The empty string enables all available decoders and implicitly |
389 | 389 | // sets a matching 'Accept-Encoding' header. |
390 | 390 | $conf[\CURLOPT_ENCODING] = ''; |
@@ -404,11 +404,11 @@ discard block |
||
404 | 404 | } elseif (!\is_dir(\dirname($sink))) { |
405 | 405 | // Ensure that the directory exists before failing in curl. |
406 | 406 | throw new \RuntimeException(\sprintf('Directory %s does not exist for sink value of %s', \dirname($sink), $sink)); |
407 | - } else { |
|
407 | + }else { |
|
408 | 408 | $sink = new LazyOpenStream($sink, 'w+'); |
409 | 409 | } |
410 | 410 | $easy->sink = $sink; |
411 | - $conf[\CURLOPT_WRITEFUNCTION] = static function ($ch, $write) use ($sink): int { |
|
411 | + $conf[\CURLOPT_WRITEFUNCTION] = static function($ch, $write) use ($sink): int { |
|
412 | 412 | return $sink->write($write); |
413 | 413 | }; |
414 | 414 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | if (isset($options['proxy'])) { |
440 | 440 | if (!\is_array($options['proxy'])) { |
441 | 441 | $conf[\CURLOPT_PROXY] = $options['proxy']; |
442 | - } else { |
|
442 | + }else { |
|
443 | 443 | $scheme = $easy->request->getUri()->getScheme(); |
444 | 444 | if (isset($options['proxy'][$scheme])) { |
445 | 445 | $host = $easy->request->getUri()->getHost(); |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | if (\is_array($options['ssl_key'])) { |
473 | 473 | if (\count($options['ssl_key']) === 2) { |
474 | 474 | [$sslKey, $conf[\CURLOPT_SSLKEYPASSWD]] = $options['ssl_key']; |
475 | - } else { |
|
475 | + }else { |
|
476 | 476 | [$sslKey] = $options['ssl_key']; |
477 | 477 | } |
478 | 478 | } |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | throw new \InvalidArgumentException('progress client option must be callable'); |
492 | 492 | } |
493 | 493 | $conf[\CURLOPT_NOPROGRESS] = false; |
494 | - $conf[\CURLOPT_PROGRESSFUNCTION] = static function ($resource, int $downloadSize, int $downloaded, int $uploadSize, int $uploaded) use ($progress) { |
|
494 | + $conf[\CURLOPT_PROGRESSFUNCTION] = static function($resource, int $downloadSize, int $downloaded, int $uploadSize, int $uploaded) use ($progress) { |
|
495 | 495 | $progress($downloadSize, $downloaded, $uploadSize, $uploaded); |
496 | 496 | }; |
497 | 497 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $ctx['error'] = 'The connection unexpectedly failed without ' |
526 | 526 | . 'providing an error. The request would have been retried, ' |
527 | 527 | . 'but attempting to rewind the request body failed. ' |
528 | - . 'Exception: ' . $e; |
|
528 | + . 'Exception: '.$e; |
|
529 | 529 | return self::createRejection($easy, $ctx); |
530 | 530 | } |
531 | 531 | |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | . 'the debug option to see what went wrong. See ' |
541 | 541 | . 'https://bugs.php.net/bug.php?id=47204 for more information.'; |
542 | 542 | return self::createRejection($easy, $ctx); |
543 | - } else { |
|
543 | + }else { |
|
544 | 544 | $easy->options['_curl_retries']++; |
545 | 545 | } |
546 | 546 | |
@@ -555,11 +555,11 @@ discard block |
||
555 | 555 | if (!\is_callable($onHeaders)) { |
556 | 556 | throw new \InvalidArgumentException('on_headers must be callable'); |
557 | 557 | } |
558 | - } else { |
|
558 | + }else { |
|
559 | 559 | $onHeaders = null; |
560 | 560 | } |
561 | 561 | |
562 | - return static function ($ch, $h) use ( |
|
562 | + return static function($ch, $h) use ( |
|
563 | 563 | $onHeaders, |
564 | 564 | $easy, |
565 | 565 | &$startingResponse |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | } elseif ($startingResponse) { |
587 | 587 | $startingResponse = false; |
588 | 588 | $easy->headers = [$value]; |
589 | - } else { |
|
589 | + }else { |
|
590 | 590 | $easy->headers[] = $value; |
591 | 591 | } |
592 | 592 | return \strlen($h); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | || false !== \strpos($message, "connection attempt failed") |
71 | 71 | ) { |
72 | 72 | $e = new ConnectException($e->getMessage(), $request, $e); |
73 | - } else { |
|
73 | + }else { |
|
74 | 74 | $e = RequestException::wrapException($request, $e); |
75 | 75 | } |
76 | 76 | $this->invokeStats($options, $request, $startTime, null, $e); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $length = (int) $stream->getSize(); |
180 | 180 | if ($length === 0) { |
181 | 181 | unset($headers[$normalizedKeys['content-length']]); |
182 | - } else { |
|
182 | + }else { |
|
183 | 183 | $headers[$normalizedKeys['content-length']] = [$length]; |
184 | 184 | } |
185 | 185 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | private function createResource(callable $callback) |
229 | 229 | { |
230 | 230 | $errors = []; |
231 | - \set_error_handler(static function ($_, $msg, $file, $line) use (&$errors): bool { |
|
231 | + \set_error_handler(static function($_, $msg, $file, $line) use (&$errors): bool { |
|
232 | 232 | $errors[] = [ |
233 | 233 | 'message' => $msg, |
234 | 234 | 'file' => $file, |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $message = 'Error creating resource: '; |
248 | 248 | foreach ($errors as $err) { |
249 | 249 | foreach ($err as $key => $value) { |
250 | - $message .= "[$key] $value" . \PHP_EOL; |
|
250 | + $message .= "[$key] $value".\PHP_EOL; |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | throw new \RuntimeException(\trim($message)); |
@@ -314,13 +314,13 @@ discard block |
||
314 | 314 | $uri = $this->resolveHost($request, $options); |
315 | 315 | |
316 | 316 | $contextResource = $this->createResource( |
317 | - static function () use ($context, $params) { |
|
317 | + static function() use ($context, $params) { |
|
318 | 318 | return \stream_context_create($context, $params); |
319 | 319 | } |
320 | 320 | ); |
321 | 321 | |
322 | 322 | return $this->createResource( |
323 | - function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) { |
|
323 | + function() use ($uri, &$http_response_header, $contextResource, $context, $options, $request) { |
|
324 | 324 | $resource = @\fopen((string) $uri, 'r', false, $contextResource); |
325 | 325 | $this->lastHeaders = $http_response_header ?? []; |
326 | 326 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | if (false === $records || !isset($records[0]['ipv6'])) { |
358 | 358 | throw new ConnectException(\sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); |
359 | 359 | } |
360 | - return $uri->withHost('[' . $records[0]['ipv6'] . ']'); |
|
360 | + return $uri->withHost('['.$records[0]['ipv6'].']'); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | |
411 | 411 | if (!\is_array($value)) { |
412 | 412 | $uri = $value; |
413 | - } else { |
|
413 | + }else { |
|
414 | 414 | $scheme = $request->getUri()->getScheme(); |
415 | 415 | if (isset($value[$scheme])) { |
416 | 416 | if (!isset($value['no']) || !Utils::isHostInNoProxy($request->getUri()->getHost(), $value['no'])) { |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | { |
523 | 523 | self::addNotification( |
524 | 524 | $params, |
525 | - static function ($code, $a, $b, $c, $transferred, $total) use ($value) { |
|
525 | + static function($code, $a, $b, $c, $transferred, $total) use ($value) { |
|
526 | 526 | if ($code == \STREAM_NOTIFY_PROGRESS) { |
527 | 527 | // The upload progress cannot be determined. Use 0 for cURL compatibility: |
528 | 528 | // https://curl.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html |
@@ -556,13 +556,13 @@ discard block |
||
556 | 556 | static $args = ['severity', 'message', 'message_code', 'bytes_transferred', 'bytes_max']; |
557 | 557 | |
558 | 558 | $value = Utils::debugResource($value); |
559 | - $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); |
|
559 | + $ident = $request->getMethod().' '.$request->getUri()->withFragment(''); |
|
560 | 560 | self::addNotification( |
561 | 561 | $params, |
562 | - static function (int $code, ...$passed) use ($ident, $value, $map, $args): void { |
|
562 | + static function(int $code, ...$passed) use ($ident, $value, $map, $args): void { |
|
563 | 563 | \fprintf($value, '<%s> [%s] ', $ident, $map[$code]); |
564 | 564 | foreach (\array_filter($passed) as $i => $v) { |
565 | - \fwrite($value, $args[$i] . ': "' . $v . '" '); |
|
565 | + \fwrite($value, $args[$i].': "'.$v.'" '); |
|
566 | 566 | } |
567 | 567 | \fwrite($value, "\n"); |
568 | 568 | } |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | // Wrap the existing function if needed. |
575 | 575 | if (!isset($params['notification'])) { |
576 | 576 | $params['notification'] = $notify; |
577 | - } else { |
|
577 | + }else { |
|
578 | 578 | $params['notification'] = self::callArray([ |
579 | 579 | $params['notification'], |
580 | 580 | $notify |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | |
585 | 585 | private static function callArray(array $functions): callable |
586 | 586 | { |
587 | - return static function (...$args) use ($functions) { |
|
587 | + return static function(...$args) use ($functions) { |
|
588 | 588 | foreach ($functions as $fn) { |
589 | 589 | $fn(...$args); |
590 | 590 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $bodyLength = (int) $this->sink->getSize(); |
82 | 82 | if ($bodyLength) { |
83 | 83 | $headers[$normalizedKeys['content-length']] = $bodyLength; |
84 | - } else { |
|
84 | + }else { |
|
85 | 85 | unset($headers[$normalizedKeys['content-length']]); |
86 | 86 | } |
87 | 87 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function __get($name) |
108 | 108 | { |
109 | - $msg = $name === 'handle' ? 'The EasyHandle has been released' : 'Invalid property: ' . $name; |
|
109 | + $msg = $name === 'handle' ? 'The EasyHandle has been released' : 'Invalid property: '.$name; |
|
110 | 110 | throw new \BadMethodCallException($msg); |
111 | 111 | } |
112 | 112 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } elseif ($selectTimeout = Utils::getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { |
74 | 74 | @trigger_error('Since guzzlehttp/guzzle 7.2.0: Using environment variable GUZZLE_CURL_SELECT_TIMEOUT is deprecated. Use option "select_timeout" instead.', \E_USER_DEPRECATED); |
75 | 75 | $this->selectTimeout = (int) $selectTimeout; |
76 | - } else { |
|
76 | + }else { |
|
77 | 77 | $this->selectTimeout = 1; |
78 | 78 | } |
79 | 79 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $promise = new Promise( |
127 | 127 | [$this, 'execute'], |
128 | - function () use ($id) { |
|
128 | + function() use ($id) { |
|
129 | 129 | return $this->cancel($id); |
130 | 130 | } |
131 | 131 | ); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $this->handles[$id] = $entry; |
192 | 192 | if (empty($easy->options['delay'])) { |
193 | 193 | \curl_multi_add_handle($this->_mh, $easy->handle); |
194 | - } else { |
|
194 | + }else { |
|
195 | 195 | $this->delays[$id] = Utils::currentTime() + ($easy->options['delay'] / 1000); |
196 | 196 | } |
197 | 197 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | : P\Create::promiseFor($response); |
113 | 113 | |
114 | 114 | return $response->then( |
115 | - function (?ResponseInterface $value) use ($request, $options) { |
|
115 | + function(?ResponseInterface $value) use ($request, $options) { |
|
116 | 116 | $this->invokeStats($request, $options, $value); |
117 | 117 | if ($this->onFulfilled) { |
118 | 118 | ($this->onFulfilled)($value); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | return $value; |
135 | 135 | }, |
136 | - function ($reason) use ($request, $options) { |
|
136 | + function($reason) use ($request, $options) { |
|
137 | 137 | $this->invokeStats($request, $options, null, $reason); |
138 | 138 | if ($this->onRejected) { |
139 | 139 | ($this->onRejected)($reason); |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | || \is_callable($value) |
159 | 159 | ) { |
160 | 160 | $this->queue[] = $value; |
161 | - } else { |
|
162 | - throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found ' . Utils::describeType($value)); |
|
161 | + }else { |
|
162 | + throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found '.Utils::describeType($value)); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public static function cookies(): callable |
27 | 27 | { |
28 | - return static function (callable $handler): callable { |
|
29 | - return static function ($request, array $options) use ($handler) { |
|
28 | + return static function(callable $handler): callable { |
|
29 | + return static function($request, array $options) use ($handler) { |
|
30 | 30 | if (empty($options['cookies'])) { |
31 | 31 | return $handler($request, $options); |
32 | 32 | } elseif (!($options['cookies'] instanceof CookieJarInterface)) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $request = $cookieJar->withCookieHeader($request); |
37 | 37 | return $handler($request, $options) |
38 | 38 | ->then( |
39 | - static function (ResponseInterface $response) use ($cookieJar, $request): ResponseInterface { |
|
39 | + static function(ResponseInterface $response) use ($cookieJar, $request): ResponseInterface { |
|
40 | 40 | $cookieJar->extractCookies($request, $response); |
41 | 41 | return $response; |
42 | 42 | } |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public static function httpErrors(BodySummarizerInterface $bodySummarizer = null): callable |
57 | 57 | { |
58 | - return static function (callable $handler) use ($bodySummarizer): callable { |
|
59 | - return static function ($request, array $options) use ($handler, $bodySummarizer) { |
|
58 | + return static function(callable $handler) use ($bodySummarizer): callable { |
|
59 | + return static function($request, array $options) use ($handler, $bodySummarizer) { |
|
60 | 60 | if (empty($options['http_errors'])) { |
61 | 61 | return $handler($request, $options); |
62 | 62 | } |
63 | 63 | return $handler($request, $options)->then( |
64 | - static function (ResponseInterface $response) use ($request, $bodySummarizer) { |
|
64 | + static function(ResponseInterface $response) use ($request, $bodySummarizer) { |
|
65 | 65 | $code = $response->getStatusCode(); |
66 | 66 | if ($code < 400) { |
67 | 67 | return $response; |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); |
89 | 89 | } |
90 | 90 | |
91 | - return static function (callable $handler) use (&$container): callable { |
|
92 | - return static function (RequestInterface $request, array $options) use ($handler, &$container) { |
|
91 | + return static function(callable $handler) use (&$container): callable { |
|
92 | + return static function(RequestInterface $request, array $options) use ($handler, &$container) { |
|
93 | 93 | return $handler($request, $options)->then( |
94 | - static function ($value) use ($request, &$container, $options) { |
|
94 | + static function($value) use ($request, &$container, $options) { |
|
95 | 95 | $container[] = [ |
96 | 96 | 'request' => $request, |
97 | 97 | 'response' => $value, |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ]; |
101 | 101 | return $value; |
102 | 102 | }, |
103 | - static function ($reason) use ($request, &$container, $options) { |
|
103 | + static function($reason) use ($request, &$container, $options) { |
|
104 | 104 | $container[] = [ |
105 | 105 | 'request' => $request, |
106 | 106 | 'response' => null, |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public static function tap(callable $before = null, callable $after = null): callable |
131 | 131 | { |
132 | - return static function (callable $handler) use ($before, $after): callable { |
|
133 | - return static function (RequestInterface $request, array $options) use ($handler, $before, $after) { |
|
132 | + return static function(callable $handler) use ($before, $after): callable { |
|
133 | + return static function(RequestInterface $request, array $options) use ($handler, $before, $after) { |
|
134 | 134 | if ($before) { |
135 | 135 | $before($request, $options); |
136 | 136 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public static function redirect(): callable |
152 | 152 | { |
153 | - return static function (callable $handler): RedirectMiddleware { |
|
153 | + return static function(callable $handler): RedirectMiddleware { |
|
154 | 154 | return new RedirectMiddleware($handler); |
155 | 155 | }; |
156 | 156 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public static function retry(callable $decider, callable $delay = null): callable |
174 | 174 | { |
175 | - return static function (callable $handler) use ($decider, $delay): RetryMiddleware { |
|
175 | + return static function(callable $handler) use ($decider, $delay): RetryMiddleware { |
|
176 | 176 | return new RetryMiddleware($decider, $handler, $delay); |
177 | 177 | }; |
178 | 178 | } |
@@ -196,15 +196,15 @@ discard block |
||
196 | 196 | throw new \LogicException(sprintf('Argument 2 to %s::log() must be of type %s', self::class, MessageFormatterInterface::class)); |
197 | 197 | } |
198 | 198 | |
199 | - return static function (callable $handler) use ($logger, $formatter, $logLevel): callable { |
|
200 | - return static function (RequestInterface $request, array $options = []) use ($handler, $logger, $formatter, $logLevel) { |
|
199 | + return static function(callable $handler) use ($logger, $formatter, $logLevel): callable { |
|
200 | + return static function(RequestInterface $request, array $options = []) use ($handler, $logger, $formatter, $logLevel) { |
|
201 | 201 | return $handler($request, $options)->then( |
202 | - static function ($response) use ($logger, $request, $formatter, $logLevel): ResponseInterface { |
|
202 | + static function($response) use ($logger, $request, $formatter, $logLevel): ResponseInterface { |
|
203 | 203 | $message = $formatter->format($request, $response); |
204 | 204 | $logger->log($logLevel, $message); |
205 | 205 | return $response; |
206 | 206 | }, |
207 | - static function ($reason) use ($logger, $request, $formatter): PromiseInterface { |
|
207 | + static function($reason) use ($logger, $request, $formatter): PromiseInterface { |
|
208 | 208 | $response = $reason instanceof RequestException ? $reason->getResponse() : null; |
209 | 209 | $message = $formatter->format($request, $response, P\Create::exceptionFor($reason)); |
210 | 210 | $logger->error($message); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public static function prepareBody(): callable |
223 | 223 | { |
224 | - return static function (callable $handler): PrepareBodyMiddleware { |
|
224 | + return static function(callable $handler): PrepareBodyMiddleware { |
|
225 | 225 | return new PrepareBodyMiddleware($handler); |
226 | 226 | }; |
227 | 227 | } |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public static function mapRequest(callable $fn): callable |
237 | 237 | { |
238 | - return static function (callable $handler) use ($fn): callable { |
|
239 | - return static function (RequestInterface $request, array $options) use ($handler, $fn) { |
|
238 | + return static function(callable $handler) use ($fn): callable { |
|
239 | + return static function(RequestInterface $request, array $options) use ($handler, $fn) { |
|
240 | 240 | return $handler($fn($request), $options); |
241 | 241 | }; |
242 | 242 | }; |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public static function mapResponse(callable $fn): callable |
253 | 253 | { |
254 | - return static function (callable $handler) use ($fn): callable { |
|
255 | - return static function (RequestInterface $request, array $options) use ($handler, $fn) { |
|
254 | + return static function(callable $handler) use ($fn): callable { |
|
255 | + return static function(RequestInterface $request, array $options) use ($handler, $fn) { |
|
256 | 256 | return $handler($request, $options)->then($fn); |
257 | 257 | }; |
258 | 258 | }; |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | $stack = []; |
87 | 87 | |
88 | 88 | if ($this->handler !== null) { |
89 | - $stack[] = "0) Handler: " . $this->debugCallable($this->handler); |
|
89 | + $stack[] = "0) Handler: ".$this->debugCallable($this->handler); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $result = ''; |
93 | 93 | foreach (\array_reverse($this->stack) as $tuple) { |
94 | 94 | $depth++; |
95 | 95 | $str = "{$depth}) Name: '{$tuple[1]}', "; |
96 | - $str .= "Function: " . $this->debugCallable($tuple[0]); |
|
96 | + $str .= "Function: ".$this->debugCallable($tuple[0]); |
|
97 | 97 | $result = "> {$str}\n{$result}"; |
98 | 98 | $stack[] = $str; |
99 | 99 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function hasHandler(): bool |
124 | 124 | { |
125 | - return $this->handler !== null ; |
|
125 | + return $this->handler !== null; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $idx = \is_callable($remove) ? 0 : 1; |
189 | 189 | $this->stack = \array_values(\array_filter( |
190 | 190 | $this->stack, |
191 | - static function ($tuple) use ($idx, $remove) { |
|
191 | + static function($tuple) use ($idx, $remove) { |
|
192 | 192 | return $tuple[$idx] !== $remove; |
193 | 193 | } |
194 | 194 | )); |
@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | if ($before) { |
241 | 241 | if ($idx === 0) { |
242 | 242 | \array_unshift($this->stack, $tuple); |
243 | - } else { |
|
243 | + }else { |
|
244 | 244 | $replacement = [$tuple, $this->stack[$idx]]; |
245 | 245 | \array_splice($this->stack, $idx, 1, $replacement); |
246 | 246 | } |
247 | 247 | } elseif ($idx === \count($this->stack) - 1) { |
248 | 248 | $this->stack[] = $tuple; |
249 | - } else { |
|
249 | + }else { |
|
250 | 250 | $replacement = [$this->stack[$idx], $tuple]; |
251 | 251 | \array_splice($this->stack, $idx, 1, $replacement); |
252 | 252 | } |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | if (\is_array($fn)) { |
267 | 267 | return \is_string($fn[0]) |
268 | 268 | ? "callable({$fn[0]}::{$fn[1]})" |
269 | - : "callable(['" . \get_class($fn[0]) . "', '{$fn[1]}'])"; |
|
269 | + : "callable(['".\get_class($fn[0])."', '{$fn[1]}'])"; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** @var object $fn */ |
273 | - return 'callable(' . \spl_object_hash($fn) . ')'; |
|
273 | + return 'callable('.\spl_object_hash($fn).')'; |
|
274 | 274 | } |
275 | 275 | } |