Skip to content

Commit 90d0f9e

Browse files
tigitznicolas-grekas
authored andcommitted
Leverage arrow function syntax for closure
1 parent c365fd8 commit 90d0f9e

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Tests/Transport/ConnectionTest.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ public function testAck()
175175

176176
$client = $this->createMock(PheanstalkInterface::class);
177177
$client->expects($this->once())->method('useTube')->with($tube)->willReturn($client);
178-
$client->expects($this->once())->method('delete')->with($this->callback(function (JobId $jobId) use ($id): bool {
179-
return $jobId->getId() === $id;
180-
}));
178+
$client->expects($this->once())->method('delete')->with($this->callback(fn (JobId $jobId): bool => $jobId->getId() === $id));
181179

182180
$connection = new Connection(['tube_name' => $tube], $client);
183181

@@ -194,9 +192,7 @@ public function testAckWhenABeanstalkdExceptionOccurs()
194192

195193
$client = $this->createMock(PheanstalkInterface::class);
196194
$client->expects($this->once())->method('useTube')->with($tube)->willReturn($client);
197-
$client->expects($this->once())->method('delete')->with($this->callback(function (JobId $jobId) use ($id): bool {
198-
return $jobId->getId() === $id;
199-
}))->willThrowException($exception);
195+
$client->expects($this->once())->method('delete')->with($this->callback(fn (JobId $jobId): bool => $jobId->getId() === $id))->willThrowException($exception);
200196

201197
$connection = new Connection(['tube_name' => $tube], $client);
202198

@@ -212,9 +208,7 @@ public function testReject()
212208

213209
$client = $this->createMock(PheanstalkInterface::class);
214210
$client->expects($this->once())->method('useTube')->with($tube)->willReturn($client);
215-
$client->expects($this->once())->method('delete')->with($this->callback(function (JobId $jobId) use ($id): bool {
216-
return $jobId->getId() === $id;
217-
}));
211+
$client->expects($this->once())->method('delete')->with($this->callback(fn (JobId $jobId): bool => $jobId->getId() === $id));
218212

219213
$connection = new Connection(['tube_name' => $tube], $client);
220214

@@ -231,9 +225,7 @@ public function testRejectWhenABeanstalkdExceptionOccurs()
231225

232226
$client = $this->createMock(PheanstalkInterface::class);
233227
$client->expects($this->once())->method('useTube')->with($tube)->willReturn($client);
234-
$client->expects($this->once())->method('delete')->with($this->callback(function (JobId $jobId) use ($id): bool {
235-
return $jobId->getId() === $id;
236-
}))->willThrowException($exception);
228+
$client->expects($this->once())->method('delete')->with($this->callback(fn (JobId $jobId): bool => $jobId->getId() === $id))->willThrowException($exception);
237229

238230
$connection = new Connection(['tube_name' => $tube], $client);
239231

0 commit comments

Comments
 (0)