@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $this->decider = $decider; |
| 46 | 46 | $this->nextHandler = $nextHandler; |
| 47 | - $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; |
|
| 47 | + $this->delay = $delay ?: __CLASS__.'::exponentialDelay'; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | private function onFulfilled(RequestInterface $request, array $options): callable |
| 78 | 78 | { |
| 79 | - return function ($value) use ($request, $options) { |
|
| 79 | + return function($value) use ($request, $options) { |
|
| 80 | 80 | if (!($this->decider)( |
| 81 | 81 | $options['retries'], |
| 82 | 82 | $request, |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | private function onRejected(RequestInterface $req, array $options): callable |
| 96 | 96 | { |
| 97 | - return function ($reason) use ($req, $options) { |
|
| 97 | + return function($reason) use ($req, $options) { |
|
| 98 | 98 | if (!($this->decider)( |
| 99 | 99 | $options['retries'], |
| 100 | 100 | $req, |
@@ -47,18 +47,18 @@ discard block |
||
| 47 | 47 | if (isset($config['options'])) { |
| 48 | 48 | $opts = $config['options']; |
| 49 | 49 | unset($config['options']); |
| 50 | - } else { |
|
| 50 | + }else { |
|
| 51 | 51 | $opts = []; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $iterable = P\Create::iterFor($requests); |
| 55 | - $requests = static function () use ($iterable, $client, $opts) { |
|
| 55 | + $requests = static function() use ($iterable, $client, $opts) { |
|
| 56 | 56 | foreach ($iterable as $key => $rfn) { |
| 57 | 57 | if ($rfn instanceof RequestInterface) { |
| 58 | 58 | yield $key => $client->sendAsync($rfn, $opts); |
| 59 | 59 | } elseif (\is_callable($rfn)) { |
| 60 | 60 | yield $key => $rfn($opts); |
| 61 | - } else { |
|
| 61 | + }else { |
|
| 62 | 62 | throw new \InvalidArgumentException('Each value yielded by the iterator must be a Psr7\Http\Message\RequestInterface or a callable that returns a promise that fulfills with a Psr7\Message\Http\ResponseInterface object.'); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | private static function cmpCallback(array &$options, string $name, array &$results): void |
| 112 | 112 | { |
| 113 | 113 | if (!isset($options[$name])) { |
| 114 | - $options[$name] = static function ($v, $k) use (&$results) { |
|
| 114 | + $options[$name] = static function($v, $k) use (&$results) { |
|
| 115 | 115 | $results[$k] = $v; |
| 116 | 116 | }; |
| 117 | - } else { |
|
| 117 | + }else { |
|
| 118 | 118 | $currentFn = $options[$name]; |
| 119 | - $options[$name] = static function ($v, $k) use (&$results, $currentFn) { |
|
| 119 | + $options[$name] = static function($v, $k) use (&$results, $currentFn) { |
|
| 120 | 120 | $currentFn($v, $k); |
| 121 | 121 | $results[$k] = $v; |
| 122 | 122 | }; |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $size = $request->getBody()->getSize(); |
| 54 | 54 | if ($size !== null) { |
| 55 | 55 | $modify['set_headers']['Content-Length'] = $size; |
| 56 | - } else { |
|
| 56 | + }else { |
|
| 57 | 57 | $modify['set_headers']['Transfer-Encoding'] = 'chunked'; |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | switch (\gettype($input)) { |
| 25 | 25 | case 'object': |
| 26 | - return 'object(' . \get_class($input) . ')'; |
|
| 26 | + return 'object('.\get_class($input).')'; |
|
| 27 | 27 | case 'array': |
| 28 | - return 'array(' . \count($input) . ')'; |
|
| 28 | + return 'array('.\count($input).')'; |
|
| 29 | 29 | default: |
| 30 | 30 | \ob_start(); |
| 31 | 31 | \var_dump($input); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | // Special match if the area when prefixed with ".". Remove any |
| 246 | 246 | // existing leading "." and add a new leading ".". |
| 247 | - $area = '.' . \ltrim($area, '.'); |
|
| 247 | + $area = '.'.\ltrim($area, '.'); |
|
| 248 | 248 | if (\substr($host, -(\strlen($area))) === $area) { |
| 249 | 249 | return true; |
| 250 | 250 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | { |
| 273 | 273 | $data = \json_decode($json, $assoc, $depth, $options); |
| 274 | 274 | if (\JSON_ERROR_NONE !== \json_last_error()) { |
| 275 | - throw new InvalidArgumentException('json_decode error: ' . \json_last_error_msg()); |
|
| 275 | + throw new InvalidArgumentException('json_decode error: '.\json_last_error_msg()); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | return $data; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | { |
| 294 | 294 | $json = \json_encode($value, $options, $depth); |
| 295 | 295 | if (\JSON_ERROR_NONE !== \json_last_error()) { |
| 296 | - throw new InvalidArgumentException('json_encode error: ' . \json_last_error_msg()); |
|
| 296 | + throw new InvalidArgumentException('json_encode error: '.\json_last_error_msg()); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** @var string */ |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | if ($asciiHost === false) { |
| 326 | 326 | $errorBitSet = $info['errors'] ?? 0; |
| 327 | 327 | |
| 328 | - $errorConstants = array_filter(array_keys(get_defined_constants()), static function (string $name): bool { |
|
| 328 | + $errorConstants = array_filter(array_keys(get_defined_constants()), static function(string $name): bool { |
|
| 329 | 329 | return substr($name, 0, 11) === 'IDNA_ERROR_'; |
| 330 | 330 | }); |
| 331 | 331 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | $errorMessage = 'IDN conversion failed'; |
| 340 | 340 | if ($errors) { |
| 341 | - $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')'; |
|
| 341 | + $errorMessage .= ' (errors: '.implode(', ', $errors).')'; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | throw new InvalidArgumentException($errorMessage); |
@@ -2,5 +2,5 @@ |
||
| 2 | 2 | |
| 3 | 3 | // Don't redefine the functions if included multiple times. |
| 4 | 4 | if (!function_exists('GuzzleHttp\Promise\promise_for')) { |
| 5 | - require __DIR__ . '/functions.php'; |
|
| 5 | + require __DIR__.'/functions.php'; |
|
| 6 | 6 | } |
@@ -23,11 +23,11 @@ |
||
| 23 | 23 | $message = 'The promise was rejected'; |
| 24 | 24 | |
| 25 | 25 | if ($description) { |
| 26 | - $message .= ' with reason: ' . $description; |
|
| 26 | + $message .= ' with reason: '.$description; |
|
| 27 | 27 | } elseif (is_string($reason) |
| 28 | 28 | || (is_object($reason) && method_exists($reason, '__toString')) |
| 29 | 29 | ) { |
| 30 | - $message .= ' with reason: ' . $this->reason; |
|
| 30 | + $message .= ' with reason: '.$this->reason; |
|
| 31 | 31 | } elseif ($reason instanceof \JsonSerializable) { |
| 32 | 32 | $message .= ' with reason: ' |
| 33 | 33 | . json_encode($this->reason, JSON_PRETTY_PRINT); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | public function __construct($withShutdown = true) |
| 20 | 20 | { |
| 21 | 21 | if ($withShutdown) { |
| 22 | - register_shutdown_function(function () { |
|
| 22 | + register_shutdown_function(function() { |
|
| 23 | 23 | if ($this->enableShutdown) { |
| 24 | 24 | // Only run the tasks if an E_ERROR didn't occur. |
| 25 | 25 | $err = error_get_last(); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $queue = Utils::queue(); |
| 36 | 36 | $p = new Promise([$queue, 'run']); |
| 37 | 37 | $value = $this->value; |
| 38 | - $queue->add(static function () use ($p, $value, $onFulfilled) { |
|
| 38 | + $queue->add(static function() use ($p, $value, $onFulfilled) { |
|
| 39 | 39 | if (Is::pending($p)) { |
| 40 | 40 | try { |
| 41 | 41 | $p->resolve($onFulfilled($value)); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | private function createPromise() |
| 105 | 105 | { |
| 106 | 106 | $this->mutex = false; |
| 107 | - $this->aggregate = new Promise(function () { |
|
| 107 | + $this->aggregate = new Promise(function() { |
|
| 108 | 108 | if ($this->checkIfFinished()) { |
| 109 | 109 | return; |
| 110 | 110 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | }); |
| 122 | 122 | |
| 123 | 123 | // Clear the references when the promise is resolved. |
| 124 | - $clearFn = function () { |
|
| 124 | + $clearFn = function() { |
|
| 125 | 125 | $this->iterable = $this->concurrency = $this->pending = null; |
| 126 | 126 | $this->onFulfilled = $this->onRejected = null; |
| 127 | 127 | $this->nextPendingIndex = 0; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $idx = $this->nextPendingIndex++; |
| 173 | 173 | |
| 174 | 174 | $this->pending[$idx] = $promise->then( |
| 175 | - function ($value) use ($idx, $key) { |
|
| 175 | + function($value) use ($idx, $key) { |
|
| 176 | 176 | if ($this->onFulfilled) { |
| 177 | 177 | call_user_func( |
| 178 | 178 | $this->onFulfilled, |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | $this->step($idx); |
| 185 | 185 | }, |
| 186 | - function ($reason) use ($idx, $key) { |
|
| 186 | + function($reason) use ($idx, $key) { |
|
| 187 | 187 | if ($this->onRejected) { |
| 188 | 188 | call_user_func( |
| 189 | 189 | $this->onRejected, |