Skip to content

Commit df52cfc

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 9a7d0ac + 39f4526 commit df52cfc

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Transport/Connection.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,7 @@ public function publish(string $body, array $headers = [], int $delayInMs = 0, A
306306
*/
307307
public function countMessagesInQueues(): int
308308
{
309-
return array_sum(array_map(function ($queueName) {
310-
return $this->queue($queueName)->declareQueue();
311-
}, $this->getQueueNames()));
309+
return array_sum(array_map(fn ($queueName) => $this->queue($queueName)->declareQueue(), $this->getQueueNames()));
312310
}
313311

314312
/**
@@ -494,12 +492,8 @@ public function channel(): \AMQPChannel
494492
if ('' !== ($this->connectionOptions['confirm_timeout'] ?? '')) {
495493
$this->amqpChannel->confirmSelect();
496494
$this->amqpChannel->setConfirmCallback(
497-
static function (): bool {
498-
return false;
499-
},
500-
static function (): bool {
501-
return false;
502-
}
495+
static fn (): bool => false,
496+
static fn (): bool => false
503497
);
504498
}
505499

0 commit comments

Comments
 (0)