@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | return new static( |
63 | 63 | $this->resolver($onFulfilled, $onRejected), |
64 | - static function () use (&$parent): void { |
|
64 | + static function() use (&$parent): void { |
|
65 | 65 | assert($parent instanceof self); |
66 | 66 | --$parent->requiredCancelRequests; |
67 | 67 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @param callable(TThrowable): (PromiseInterface<TRejected>|TRejected) $onRejected |
81 | 81 | * @return PromiseInterface<T|TRejected> |
82 | 82 | */ |
83 | - public function catch(callable $onRejected): PromiseInterface |
|
83 | + public function catch (callable $onRejected): PromiseInterface |
|
84 | 84 | { |
85 | - return $this->then(null, static function (\Throwable $reason) use ($onRejected) { |
|
85 | + return $this->then(null, static function(\Throwable $reason) use ($onRejected) { |
|
86 | 86 | if (!_checkTypehint($onRejected, $reason)) { |
87 | 87 | return new RejectedPromise($reason); |
88 | 88 | } |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | |
97 | 97 | public function finally(callable $onFulfilledOrRejected): PromiseInterface |
98 | 98 | { |
99 | - return $this->then(static function ($value) use ($onFulfilledOrRejected): PromiseInterface { |
|
100 | - return resolve($onFulfilledOrRejected())->then(function () use ($value) { |
|
99 | + return $this->then(static function($value) use ($onFulfilledOrRejected): PromiseInterface { |
|
100 | + return resolve($onFulfilledOrRejected())->then(function() use ($value) { |
|
101 | 101 | return $value; |
102 | 102 | }); |
103 | - }, static function (\Throwable $reason) use ($onFulfilledOrRejected): PromiseInterface { |
|
104 | - return resolve($onFulfilledOrRejected())->then(function () use ($reason): RejectedPromise { |
|
103 | + }, static function(\Throwable $reason) use ($onFulfilledOrRejected): PromiseInterface { |
|
104 | + return resolve($onFulfilledOrRejected())->then(function() use ($reason): RejectedPromise { |
|
105 | 105 | return new RejectedPromise($reason); |
106 | 106 | }); |
107 | 107 | }); |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | |
169 | 169 | private function resolver(?callable $onFulfilled = null, ?callable $onRejected = null): callable |
170 | 170 | { |
171 | - return function (callable $resolve, callable $reject) use ($onFulfilled, $onRejected): void { |
|
172 | - $this->handlers[] = static function (PromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject): void { |
|
171 | + return function(callable $resolve, callable $reject) use ($onFulfilled, $onRejected) : void { |
|
172 | + $this->handlers[] = static function(PromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject) : void { |
|
173 | 173 | $promise = $promise->then($onFulfilled, $onRejected); |
174 | 174 | |
175 | 175 | if ($promise instanceof self && $promise->result === null) { |
176 | - $promise->handlers[] = static function (PromiseInterface $promise) use ($resolve, $reject): void { |
|
176 | + $promise->handlers[] = static function(PromiseInterface $promise) use ($resolve, $reject): void { |
|
177 | 177 | $promise->then($resolve, $reject); |
178 | 178 | }; |
179 | 179 | } else { |
@@ -278,16 +278,16 @@ discard block |
||
278 | 278 | // garbage cycles if any callback creates an Exception. |
279 | 279 | // These assumptions are covered by the test suite, so if you ever feel like |
280 | 280 | // refactoring this, go ahead, any alternative suggestions are welcome! |
281 | - $target =& $this; |
|
281 | + $target = & $this; |
|
282 | 282 | |
283 | 283 | $callback( |
284 | - static function ($value) use (&$target): void { |
|
284 | + static function($value) use (&$target): void { |
|
285 | 285 | if ($target !== null) { |
286 | 286 | $target->settle(resolve($value)); |
287 | 287 | $target = null; |
288 | 288 | } |
289 | 289 | }, |
290 | - static function (\Throwable $reason) use (&$target): void { |
|
290 | + static function(\Throwable $reason) use (&$target): void { |
|
291 | 291 | if ($target !== null) { |
292 | 292 | $target->reject($reason); |
293 | 293 | $target = null; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (!\function_exists('React\Promise\resolve')) { |
4 | - require __DIR__.'/functions.php'; |
|
4 | + require __DIR__ . '/functions.php'; |
|
5 | 5 | } |
@@ -22,6 +22,6 @@ |
||
22 | 22 | */ |
23 | 23 | function trigger_deprecation(string $package, string $version, string $message, mixed ...$args): void |
24 | 24 | { |
25 | - @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); |
|
25 | + @trigger_error(($package || $version ? "Since $package $version: " : '') . ($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); |
|
26 | 26 | } |
27 | 27 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | use Symfony\Polyfill\Ctype as p; |
13 | 13 | |
14 | 14 | if (\PHP_VERSION_ID >= 80000) { |
15 | - return require __DIR__.'/bootstrap80.php'; |
|
15 | + return require __DIR__ . '/bootstrap80.php'; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if (!function_exists('ctype_alnum')) { |
@@ -220,7 +220,7 @@ |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | if (\PHP_VERSION_ID >= 80100) { |
223 | - @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED); |
|
223 | + @trigger_error($function . '(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | if ($int < 0) { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; } |
20 | 20 | } |
21 | 21 | if (!function_exists('hrtime')) { |
22 | - require_once __DIR__.'/Php73.php'; |
|
22 | + require_once __DIR__ . '/Php73.php'; |
|
23 | 23 | p\Php73::$startAt = (int) microtime(true); |
24 | 24 | function hrtime($as_number = false) { return p\Php73::hrtime($as_number); } |
25 | 25 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | return $class; |
55 | 55 | } |
56 | 56 | |
57 | - return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous'; |
|
57 | + return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class') . '@anonymous'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public static function get_resource_id($res): int |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public function __construct(string $data, string $postname, string $mime = 'application/octet-stream') |
21 | 21 | { |
22 | 22 | $this->data = $data; |
23 | - parent::__construct('data://application/octet-stream;base64,'.base64_encode($data), $mime, $postname); |
|
23 | + parent::__construct('data://application/octet-stream;base64,' . base64_encode($data), $mime, $postname); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function __set(string $name, $value): void |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) { |
35 | - throw new TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string'); |
|
35 | + throw new TypeError('Cannot assign ' . gettype($value) . ' to property CURLStringFile::$data of type string'); |
|
36 | 36 | } |
37 | 37 | |
38 | - $this->name = 'data://application/octet-stream;base64,'.base64_encode($value); |
|
38 | + $this->name = 'data://application/octet-stream;base64,' . base64_encode($value); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function __isset(string $name): bool |
@@ -16,7 +16,7 @@ |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | if (\PHP_VERSION_ID >= 80000) { |
19 | - return require __DIR__.'/bootstrap80.php'; |
|
19 | + return require __DIR__ . '/bootstrap80.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | if (!defined('GRAPHEME_EXTR_COUNT')) { |