@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function toArray(): array |
103 | 103 | { |
104 | - return \array_map(static function (SetCookie $cookie): array { |
|
104 | + return \array_map(static function(SetCookie $cookie): array { |
|
105 | 105 | return $cookie->toArray(); |
106 | 106 | }, $this->getIterator()->getArrayCopy()); |
107 | 107 | } |
@@ -117,22 +117,22 @@ discard block |
||
117 | 117 | } elseif (!$path) { |
118 | 118 | $this->cookies = \array_filter( |
119 | 119 | $this->cookies, |
120 | - static function (SetCookie $cookie) use ($domain): bool { |
|
120 | + static function(SetCookie $cookie) use ($domain): bool { |
|
121 | 121 | return !$cookie->matchesDomain($domain); |
122 | 122 | } |
123 | 123 | ); |
124 | 124 | } elseif (!$name) { |
125 | 125 | $this->cookies = \array_filter( |
126 | 126 | $this->cookies, |
127 | - static function (SetCookie $cookie) use ($path, $domain): bool { |
|
127 | + static function(SetCookie $cookie) use ($path, $domain): bool { |
|
128 | 128 | return !($cookie->matchesPath($path) && |
129 | 129 | $cookie->matchesDomain($domain)); |
130 | 130 | } |
131 | 131 | ); |
132 | - } else { |
|
132 | + }else { |
|
133 | 133 | $this->cookies = \array_filter( |
134 | 134 | $this->cookies, |
135 | - static function (SetCookie $cookie) use ($path, $domain, $name) { |
|
135 | + static function(SetCookie $cookie) use ($path, $domain, $name) { |
|
136 | 136 | return !($cookie->getName() == $name && |
137 | 137 | $cookie->matchesPath($path) && |
138 | 138 | $cookie->matchesDomain($domain)); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | { |
149 | 149 | $this->cookies = \array_filter( |
150 | 150 | $this->cookies, |
151 | - static function (SetCookie $cookie): bool { |
|
151 | + static function(SetCookie $cookie): bool { |
|
152 | 152 | return !$cookie->getDiscard() && $cookie->getExpires(); |
153 | 153 | } |
154 | 154 | ); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $result = $cookie->validate(); |
171 | 171 | if ($result !== true) { |
172 | 172 | if ($this->strictMode) { |
173 | - throw new \RuntimeException('Invalid cookie: ' . $result); |
|
173 | + throw new \RuntimeException('Invalid cookie: '.$result); |
|
174 | 174 | } |
175 | 175 | $this->removeCookieIfEmpty($cookie); |
176 | 176 | return false; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | !$cookie->isExpired() && |
291 | 291 | (!$cookie->getSecure() || $scheme === 'https') |
292 | 292 | ) { |
293 | - $values[] = $cookie->getName() . '=' |
|
293 | + $values[] = $cookie->getName().'=' |
|
294 | 294 | . $cookie->getValue(); |
295 | 295 | } |
296 | 296 | } |
@@ -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)); |