From 3260c379c8979a0c00b8d34b6406cca0df0c61b3 Mon Sep 17 00:00:00 2001 From: spiralbot Date: Fri, 24 Jan 2025 11:16:07 +0000 Subject: [PATCH] Merge pull request #1208: Apply risky Code Style rules --- src/Config/QueueConfig.php | 2 +- tests/Core/QueueInjectorTest.php | 2 ++ tests/Interceptor/Push/CoreTest.php | 10 +++++----- tests/Job/CallableJobTest.php | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Config/QueueConfig.php b/src/Config/QueueConfig.php index 2e62110..22a9e98 100644 --- a/src/Config/QueueConfig.php +++ b/src/Config/QueueConfig.php @@ -128,7 +128,7 @@ public function getConnection(string $name): array $connections = $this->getConnections(); if (!isset($connections[$name])) { - throw new InvalidArgumentException(sprintf('Queue connection with given name `%s` is not defined.', $name)); + throw new InvalidArgumentException(\sprintf('Queue connection with given name `%s` is not defined.', $name)); } if (!isset($connections[$name]['driver'])) { diff --git a/tests/Core/QueueInjectorTest.php b/tests/Core/QueueInjectorTest.php index 11ed859..a5dc91d 100644 --- a/tests/Core/QueueInjectorTest.php +++ b/tests/Core/QueueInjectorTest.php @@ -1,5 +1,7 @@ shouldReceive('push')->once() ->withArgs( - fn(string $name, mixed $p = [], ?OptionsInterface $options = null): bool => $name === 'foo' + static fn(string $name, mixed $p = [], ?OptionsInterface $options = null): bool => $name === 'foo' && $payload === $p && $options instanceof Options, ); @@ -87,14 +87,14 @@ public function testCallWithTracerContext(): void $tracer->shouldReceive('getContext')->once()->andReturn(['foo' => ['bar']]); - $tracer->shouldReceive('trace')->once()->andReturnUsing(fn($name, $callback) => $callback()); + $tracer->shouldReceive('trace')->once()->andReturnUsing(static fn($name, $callback) => $callback()); $queue->shouldReceive('push')->once() - ->withArgs(fn(string $name, array $payload = [], ?OptionsInterface $options = null): bool => $name === 'foo' + ->withArgs(static fn(string $name, array $payload = [], ?OptionsInterface $options = null): bool => $name === 'foo' && $payload === ['baz' => 'baf'] && $options->getHeader('foo') === ['bar']); - ContainerScope::runScope($container, function () use ($core): void { + ContainerScope::runScope($container, static function () use ($core): void { $core->callAction('foo', 'bar', [ 'id' => 'job-id', 'payload' => ['baz' => 'baf'], @@ -113,7 +113,7 @@ public function testCallWithTracerContextWitoutOptionsWithHeadersSupport(): void $tracer->shouldNotReceive('getContext'); $queue->shouldReceive('push')->once() - ->withArgs(fn(string $name, array $payload = [], ?OptionsInterface $options = null): bool => $name === 'foo' + ->withArgs(static fn(string $name, array $payload = [], ?OptionsInterface $options = null): bool => $name === 'foo' && $payload === ['baz' => 'baf'] && $options !== null); diff --git a/tests/Job/CallableJobTest.php b/tests/Job/CallableJobTest.php index 5841ea2..99a6f96 100644 --- a/tests/Job/CallableJobTest.php +++ b/tests/Job/CallableJobTest.php @@ -32,7 +32,7 @@ public function testPayloadCallbackValueShouldBeClosure(): void public function testHandle(): void { - $callback = function (string $name, string $id, ContainerInterface $container): void { + $callback = static function (string $name, string $id, ContainerInterface $container): void { self::assertSame('foo', $name); self::assertSame('foo-id', $id); self::assertInstanceOf(Container::class, $container);