Skip to content

Commit fa29611

Browse files
minor #48793 Leverage arrow function syntax for closure (tigitz)
This PR was merged into the 6.3 branch. Discussion ---------- Leverage arrow function syntax for closure | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #47658 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | <!-- required for new features --> Rationale in the RFC [here](https://wiki.php.net/rfc/arrow_functions_v2#introduction) It's also notable that using arrow function syntax rather than the classic one has been enforced in the past by symfony core member: symfony/symfony#48069 (comment) So this PR would be consistent. Commits ------- f5802d3a2a Leverage arrow function syntax for closure
2 parents 44375d9 + 90d0f9e commit fa29611

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)