Skip to content

Commit b377efa

Browse files
committed
Pint
1 parent b5c9241 commit b377efa

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

src/CloudTasksQueue.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
class CloudTasksQueue extends LaravelQueue implements QueueContract
2626
{
27-
private Closure | array $headers = [];
27+
private Closure|array $headers = [];
2828

2929
public function __construct(public array $config, public CloudTasksClient $client, public $dispatchAfterCommit = false)
3030
{
@@ -152,7 +152,7 @@ private function taskName(string $queueName, array $payload): string
152152
$this->config['project'],
153153
$this->config['location'],
154154
$queueName,
155-
$displayName.'-'. bin2hex(random_bytes(8)),
155+
$displayName.'-'.bin2hex(random_bytes(8)),
156156
);
157157
}
158158

@@ -172,8 +172,7 @@ private function enrichPayloadWithInternalData(
172172
string $queueName,
173173
string $taskName,
174174
string $connectionName,
175-
): array
176-
{
175+
): array {
177176
$payload['internal'] = [
178177
'attempts' => $payload['internal']['attempts'] ?? 0,
179178
'queue' => $queueName,
@@ -188,7 +187,7 @@ public function addPayloadToTask(array $payload, Task $task): Task
188187
{
189188
$headers = value($this->headers, $payload) ?: [];
190189

191-
if (!empty($this->config['app_engine'])) {
190+
if (! empty($this->config['app_engine'])) {
192191
$path = \Safe\parse_url(route('cloud-tasks.handle-task'), PHP_URL_PATH);
193192

194193
$appEngineRequest = new AppEngineHttpRequest();
@@ -197,7 +196,7 @@ public function addPayloadToTask(array $payload, Task $task): Task
197196
$appEngineRequest->setBody(json_encode($payload));
198197
$appEngineRequest->setHeaders($headers);
199198

200-
if (!empty($service = $this->config['app_engine_service'])) {
199+
if (! empty($service = $this->config['app_engine_service'])) {
201200
$routing = new AppEngineRouting();
202201
$routing->setService($service);
203202
$appEngineRequest->setAppEngineRouting($routing);
@@ -250,14 +249,14 @@ public function getHandler(): string
250249

251250
$handler = rtrim($this->config['handler'], '/');
252251

253-
if (str_ends_with($handler, '/'. config('cloud-tasks.uri'))) {
252+
if (str_ends_with($handler, '/'.config('cloud-tasks.uri'))) {
254253
return $handler;
255254
}
256255

257-
return $handler.'/'. config('cloud-tasks.uri');
256+
return $handler.'/'.config('cloud-tasks.uri');
258257
}
259258

260-
public function setTaskHeaders(Closure | array $headers): void
259+
public function setTaskHeaders(Closure|array $headers): void
261260
{
262261
$this->headers = $headers;
263262
}

src/CloudTasksServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private function registerClient(): void
3636
$app['queue'],
3737
$app['events'],
3838
$app[ExceptionHandler::class],
39-
fn() => $app->isDownForMaintenance(),
39+
fn () => $app->isDownForMaintenance(),
4040
);
4141
});
4242

src/IncomingTask.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Stackkit\LaravelGoogleCloudTasksQueue;
66

77
use Safe\Exceptions\JsonException;
8+
89
use function Safe\json_decode;
910

1011
class IncomingTask

tests/QueueTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Illuminate\Support\Facades\Queue;
1717
use PHPUnit\Framework\Attributes\Test;
1818
use Stackkit\LaravelGoogleCloudTasksQueue\CloudTasksApi;
19-
use Stackkit\LaravelGoogleCloudTasksQueue\CloudTasksQueue;
2019
use Stackkit\LaravelGoogleCloudTasksQueue\Events\JobReleased;
2120
use Tests\Support\FailingJob;
2221
use Tests\Support\FailingJobWithExponentialBackoff;

tests/TaskHandlerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function it_can_run_a_task()
3838
$this->dispatch(new SimpleJob())->runWithoutExceptionHandler();
3939

4040
// Assert
41-
Event::assertDispatched(fn(JobOutput $event) => $event->output === 'SimpleJob:success');
41+
Event::assertDispatched(fn (JobOutput $event) => $event->output === 'SimpleJob:success');
4242
}
4343

4444
#[Test]
@@ -55,7 +55,7 @@ public function it_can_run_a_task_using_the_task_connection()
5555
$this->dispatch($job)->runWithoutExceptionHandler();
5656

5757
// Assert
58-
Event::assertDispatched(fn(JobOutput $event) => $event->output === 'SimpleJob:success');
58+
Event::assertDispatched(fn (JobOutput $event) => $event->output === 'SimpleJob:success');
5959
}
6060

6161
#[Test]
@@ -186,7 +186,7 @@ public function it_can_handle_encrypted_jobs()
186186
decrypt($job->payloadAsArray('data.command')),
187187
);
188188

189-
Event::assertDispatched(fn(JobOutput $event) => $event->output === 'EncryptedJob:success');
189+
Event::assertDispatched(fn (JobOutput $event) => $event->output === 'EncryptedJob:success');
190190
}
191191

192192
#[Test]
@@ -260,7 +260,7 @@ public function test_job_timeout()
260260
$this->dispatch(new SimpleJobWithTimeout())->run();
261261

262262
// Assert
263-
$events = Event::dispatched(JobOutput::class)->map(fn($event) => $event[0]->output)->toArray();
263+
$events = Event::dispatched(JobOutput::class)->map(fn ($event) => $event[0]->output)->toArray();
264264
$this->assertEquals([
265265
'SimpleJobWithTimeout:1',
266266
'SimpleJobWithTimeout:2',

0 commit comments

Comments
 (0)