@@ -42,28 +42,28 @@ |
||
| 42 | 42 | |
| 43 | 43 | public static function constant(int $maxRetries = self::DEFAULT_MAX_RETRIES, int $intervalMs = 100) : self |
| 44 | 44 | { |
| 45 | - return new self(static function (int $retries) use ($maxRetries, $intervalMs) { |
|
| 45 | + return new self(static function(int $retries) use ($maxRetries, $intervalMs) { |
|
| 46 | 46 | return $retries > $maxRetries ? null : $intervalMs; |
| 47 | 47 | }); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public static function exponential(int $maxRetries = self::DEFAULT_MAX_RETRIES, int $baseMs = 100) : self |
| 51 | 51 | { |
| 52 | - return new self(static function (int $retries) use ($maxRetries, $baseMs) { |
|
| 52 | + return new self(static function(int $retries) use ($maxRetries, $baseMs) { |
|
| 53 | 53 | return $retries > $maxRetries ? null : $baseMs ** $retries; |
| 54 | 54 | }); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public static function linear(int $maxRetries = self::DEFAULT_MAX_RETRIES, int $differenceMs = 100) : self |
| 58 | 58 | { |
| 59 | - return new self(static function (int $retries) use ($maxRetries, $differenceMs) { |
|
| 59 | + return new self(static function(int $retries) use ($maxRetries, $differenceMs) { |
|
| 60 | 60 | return $retries > $maxRetries ? null : $differenceMs * $retries; |
| 61 | 61 | }); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public static function custom(\Closure $getDelayMs) : self |
| 65 | 65 | { |
| 66 | - return new self(static function (int $retries, \Throwable $e) use ($getDelayMs) : ?int { |
|
| 66 | + return new self(static function(int $retries, \Throwable $e) use ($getDelayMs) : ?int { |
|
| 67 | 67 | return $getDelayMs($retries, $e); |
| 68 | 68 | }); |
| 69 | 69 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $response |
| 51 | 51 | )); |
| 52 | 52 | |
| 53 | - $middleware = RetryMiddleware::custom(static function (int $retries) : ?int { |
|
| 53 | + $middleware = RetryMiddleware::custom(static function(int $retries) : ?int { |
|
| 54 | 54 | return 0; |
| 55 | 55 | }); |
| 56 | 56 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $this->handler->expects($this->exactly(4))->method('handle') |
| 63 | 63 | ->willThrowException(new ConnectionFailed()); |
| 64 | 64 | |
| 65 | - $middleware = RetryMiddleware::custom(static function (int $retries) : ?int { |
|
| 65 | + $middleware = RetryMiddleware::custom(static function(int $retries) : ?int { |
|
| 66 | 66 | return $retries <= 3 ? 0 : null; |
| 67 | 67 | }); |
| 68 | 68 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | /** @var Middleware $middleware1 */ |
| 47 | 47 | $middleware1 = $this->createMock(Middleware::class); |
| 48 | 48 | $middleware1->expects($this->once())->method('process')->willReturnCallback( |
| 49 | - static function (Request $request, Handler $handler) use (&$trace) { |
|
| 49 | + static function(Request $request, Handler $handler) use (&$trace) { |
|
| 50 | 50 | $trace[] = 1; |
| 51 | 51 | |
| 52 | 52 | return $handler->handle($request); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | /** @var Middleware $middleware2 */ |
| 57 | 57 | $middleware2 = $this->createMock(Middleware::class); |
| 58 | 58 | $middleware2->expects($this->once())->method('process')->willReturnCallback( |
| 59 | - static function (Request $request, Handler $handler) use (&$trace) { |
|
| 59 | + static function(Request $request, Handler $handler) use (&$trace) { |
|
| 60 | 60 | $trace[] = 2; |
| 61 | 61 | |
| 62 | 62 | return $handler->handle($request); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | public function testMiddlewareRemainsAfterExecution() : void |
| 75 | 75 | { |
| 76 | - $middlewareCallback = static function (Request $request, Handler $handler) { |
|
| 76 | + $middlewareCallback = static function(Request $request, Handler $handler) { |
|
| 77 | 77 | return $handler->handle($request); |
| 78 | 78 | }; |
| 79 | 79 | |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | public function testCustomType() : void |
| 79 | 79 | { |
| 80 | 80 | $client = ClientBuilder::createFromEnv() |
| 81 | - ->setPackerPureFactory(static function () { |
|
| 81 | + ->setPackerPureFactory(static function() { |
|
| 82 | 82 | return PurePacker::fromExtensions(new DateTimeExtension(42)); |
| 83 | 83 | }) |
| 84 | - ->setPackerPeclFactory(static function () { |
|
| 84 | + ->setPackerPeclFactory(static function() { |
|
| 85 | 85 | return new PeclPacker(true); |
| 86 | 86 | }) |
| 87 | 87 | ->build(); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public function testDecimalType(string $decimalString) : void |
| 112 | 112 | { |
| 113 | 113 | $client = ClientBuilder::createFromEnv() |
| 114 | - ->setPackerPureFactory(static function () { |
|
| 114 | + ->setPackerPureFactory(static function() { |
|
| 115 | 115 | return PurePacker::fromExtensions(new DecimalExtension(1)); |
| 116 | 116 | }) |
| 117 | 117 | ->build(); |