@@ -19,13 +19,13 @@ |
||
19 | 19 | |
20 | 20 | public function __construct( |
21 | 21 | private readonly Handler $coreHandler |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** @inheritdoc */ |
26 | 26 | public function push(string $name, mixed $payload = [], OptionsInterface $options = null): string |
27 | 27 | { |
28 | - if ($options !== null && $options->getDelay()) { |
|
28 | + if ($options !== null && $options->getDelay()){ |
|
29 | 29 | \sleep($options->getDelay()); |
30 | 30 | } |
31 | 31 |
@@ -25,7 +25,8 @@ |
||
25 | 25 | /** @inheritdoc */ |
26 | 26 | public function push(string $name, mixed $payload = [], OptionsInterface $options = null): string |
27 | 27 | { |
28 | - if ($options !== null && $options->getDelay()) { |
|
28 | + if ($options !== null && $options->getDelay()) |
|
29 | + { |
|
29 | 30 | \sleep($options->getDelay()); |
30 | 31 | } |
31 | 32 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public function __construct( |
12 | 12 | private readonly ExceptionReporterInterface $reporter |
13 | - ) { |
|
13 | + ){ |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public function handle(string $driver, string $queue, string $job, mixed $payload, \Throwable $e): void |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | public function __construct( |
19 | 19 | private readonly CoreInterface $core, |
20 | - ) { |
|
20 | + ){ |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function push(string $name, mixed $payload = [], mixed $options = null): string |
@@ -13,6 +13,6 @@ |
||
13 | 13 | public readonly string $id, |
14 | 14 | public readonly mixed $payload, |
15 | 15 | public readonly array $headers = [] |
16 | - ) { |
|
16 | + ){ |
|
17 | 17 | } |
18 | 18 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public function __construct( |
22 | 22 | private readonly CoreInterface $core, |
23 | 23 | ?TracerFactoryInterface $tracerFactory = null, |
24 | - ) { |
|
24 | + ){ |
|
25 | 25 | $this->tracerFactory = $tracerFactory ?? new NullTracerFactory(new Container()); |
26 | 26 | } |
27 | 27 |
@@ -19,20 +19,20 @@ |
||
19 | 19 | |
20 | 20 | public function __construct( |
21 | 21 | protected InvokerInterface $invoker, |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function handle(string $name, string $id, mixed $payload, array $headers = []): void |
26 | 26 | { |
27 | - try { |
|
27 | + try{ |
|
28 | 28 | $params = ['payload' => $payload, 'id' => $id, 'headers' => $headers]; |
29 | 29 | |
30 | - if (\is_array($payload)) { |
|
30 | + if (\is_array($payload)){ |
|
31 | 31 | $params = \array_merge($params, $payload); |
32 | 32 | } |
33 | 33 | |
34 | 34 | $this->invoker->invoke([$this, $this->getHandlerMethod()], $params); |
35 | - } catch (\Throwable $e) { |
|
35 | + }catch (\Throwable $e){ |
|
36 | 36 | $message = \sprintf('[%s] %s', $this::class, $e->getMessage()); |
37 | 37 | throw new JobException($message, (int)$e->getCode(), $e); |
38 | 38 | } |
@@ -24,15 +24,19 @@ |
||
24 | 24 | |
25 | 25 | public function handle(string $name, string $id, mixed $payload, array $headers = []): void |
26 | 26 | { |
27 | - try { |
|
27 | + try |
|
28 | + { |
|
28 | 29 | $params = ['payload' => $payload, 'id' => $id, 'headers' => $headers]; |
29 | 30 | |
30 | - if (\is_array($payload)) { |
|
31 | + if (\is_array($payload)) |
|
32 | + { |
|
31 | 33 | $params = \array_merge($params, $payload); |
32 | 34 | } |
33 | 35 | |
34 | 36 | $this->invoker->invoke([$this, $this->getHandlerMethod()], $params); |
35 | - } catch (\Throwable $e) { |
|
37 | + } |
|
38 | + catch (\Throwable $e) |
|
39 | + { |
|
36 | 40 | $message = \sprintf('[%s] %s', $this::class, $e->getMessage()); |
37 | 41 | throw new JobException($message, (int)$e->getCode(), $e); |
38 | 42 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | final class ContainerRegistryT extends TestCase |
15 | 15 | { |
16 | - private ContainerInterface|m\MockInterface $container; |
|
16 | + private ContainerInterface | m\MockInterface $container; |
|
17 | 17 | private ContainerRegistry $registry; |
18 | 18 | |
19 | 19 | protected function setUp(): void |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $handler = m::mock(FailedJobHandlerInterface::class) |
25 | 25 | ); |
26 | 26 | |
27 | - if (!\is_array($payload)) { |
|
27 | + if (!\is_array($payload)){ |
|
28 | 28 | $this->markTestIncomplete('FailedJobHandlerInterface does not support non-array payloads'); |
29 | 29 | return; |
30 | 30 | } |
@@ -24,7 +24,8 @@ |
||
24 | 24 | $handler = m::mock(FailedJobHandlerInterface::class) |
25 | 25 | ); |
26 | 26 | |
27 | - if (!\is_array($payload)) { |
|
27 | + if (!\is_array($payload)) |
|
28 | + { |
|
28 | 29 | $this->markTestIncomplete('FailedJobHandlerInterface does not support non-array payloads'); |
29 | 30 | return; |
30 | 31 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $queue = m::mock(QueueInterface::class) |
26 | 26 | ); |
27 | 27 | |
28 | - if (!\is_array($payload)) { |
|
28 | + if (!\is_array($payload)){ |
|
29 | 29 | $this->markTestIncomplete('QueueInterface does not support non-array payloads'); |
30 | 30 | return; |
31 | 31 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $queue = m::mock(QueueInterface::class) |
52 | 52 | ); |
53 | 53 | |
54 | - if (!\is_array($payload)) { |
|
54 | + if (!\is_array($payload)){ |
|
55 | 55 | $this->markTestIncomplete('QueueInterface does not support non-array payloads'); |
56 | 56 | return; |
57 | 57 | } |
@@ -79,18 +79,18 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | $tracer->shouldReceive('getContext')->once()->andReturn(['foo' => ['bar']]); |
82 | - $tracer->shouldReceive('trace')->once()->andReturnUsing(function ($name, $callback) { |
|
82 | + $tracer->shouldReceive('trace')->once()->andReturnUsing(function ($name, $callback){ |
|
83 | 83 | return $callback(); |
84 | 84 | }); |
85 | 85 | |
86 | 86 | $queue->shouldReceive('push')->once() |
87 | - ->withArgs(function (string $name, array $payload = [], OptionsInterface $options = null) { |
|
87 | + ->withArgs(function (string $name, array $payload = [], OptionsInterface $options = null){ |
|
88 | 88 | return $name === 'foo' |
89 | 89 | && $payload === ['baz' => 'baf'] |
90 | 90 | && $options->getHeader('foo') === ['bar']; |
91 | 91 | }); |
92 | 92 | |
93 | - ContainerScope::runScope($container, function() use($core) { |
|
93 | + ContainerScope::runScope($container, function () use($core) { |
|
94 | 94 | $core->callAction('foo', 'bar', [ |
95 | 95 | 'id' => 'job-id', |
96 | 96 | 'payload' => ['baz' => 'baf'], |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $tracer->shouldNotReceive('getContext'); |
110 | 110 | |
111 | 111 | $queue->shouldReceive('push')->once() |
112 | - ->withArgs(function (string $name, array $payload = [], OptionsInterface $options = null) { |
|
112 | + ->withArgs(function (string $name, array $payload = [], OptionsInterface $options = null){ |
|
113 | 113 | return $name === 'foo' |
114 | 114 | && $payload === ['baz' => 'baf'] |
115 | 115 | && $options !== null; |
@@ -25,13 +25,15 @@ discard block |
||
25 | 25 | $queue = m::mock(QueueInterface::class) |
26 | 26 | ); |
27 | 27 | |
28 | - if (!\is_array($payload)) { |
|
28 | + if (!\is_array($payload)) |
|
29 | + { |
|
29 | 30 | $this->markTestIncomplete('QueueInterface does not support non-array payloads'); |
30 | 31 | return; |
31 | 32 | } |
32 | 33 | |
33 | 34 | $queue->shouldReceive('push')->once() |
34 | - ->withArgs(function (string $name, mixed $p = [], OptionsInterface $options = null) use($payload) { |
|
35 | + ->withArgs(function (string $name, mixed $p = [], OptionsInterface $options = null) use($payload) |
|
36 | + { |
|
35 | 37 | return $name === 'foo' && $payload === $p && $options instanceof Options; |
36 | 38 | }); |
37 | 39 | |
@@ -51,7 +53,8 @@ discard block |
||
51 | 53 | $queue = m::mock(QueueInterface::class) |
52 | 54 | ); |
53 | 55 | |
54 | - if (!\is_array($payload)) { |
|
56 | + if (!\is_array($payload)) |
|
57 | + { |
|
55 | 58 | $this->markTestIncomplete('QueueInterface does not support non-array payloads'); |
56 | 59 | return; |
57 | 60 | } |
@@ -79,18 +82,21 @@ discard block |
||
79 | 82 | |
80 | 83 | |
81 | 84 | $tracer->shouldReceive('getContext')->once()->andReturn(['foo' => ['bar']]); |
82 | - $tracer->shouldReceive('trace')->once()->andReturnUsing(function ($name, $callback) { |
|
85 | + $tracer->shouldReceive('trace')->once()->andReturnUsing(function ($name, $callback) |
|
86 | + { |
|
83 | 87 | return $callback(); |
84 | 88 | }); |
85 | 89 | |
86 | 90 | $queue->shouldReceive('push')->once() |
87 | - ->withArgs(function (string $name, array $payload = [], OptionsInterface $options = null) { |
|
91 | + ->withArgs(function (string $name, array $payload = [], OptionsInterface $options = null) |
|
92 | + { |
|
88 | 93 | return $name === 'foo' |
89 | 94 | && $payload === ['baz' => 'baf'] |
90 | 95 | && $options->getHeader('foo') === ['bar']; |
91 | 96 | }); |
92 | 97 | |
93 | - ContainerScope::runScope($container, function() use($core) { |
|
98 | + ContainerScope::runScope($container, function() use($core) |
|
99 | + { |
|
94 | 100 | $core->callAction('foo', 'bar', [ |
95 | 101 | 'id' => 'job-id', |
96 | 102 | 'payload' => ['baz' => 'baf'], |
@@ -109,7 +115,8 @@ discard block |
||
109 | 115 | $tracer->shouldNotReceive('getContext'); |
110 | 116 | |
111 | 117 | $queue->shouldReceive('push')->once() |
112 | - ->withArgs(function (string $name, array $payload = [], OptionsInterface $options = null) { |
|
118 | + ->withArgs(function (string $name, array $payload = [], OptionsInterface $options = null) |
|
119 | + { |
|
113 | 120 | return $name === 'foo' |
114 | 121 | && $payload === ['baz' => 'baf'] |
115 | 122 | && $options !== null; |