Skip to content

Commit 04f038c

Browse files
committed
fixed CS
1 parent fa98649 commit 04f038c

File tree

46 files changed

+349
-349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+349
-349
lines changed

Asynchronous/Middleware/SendMessageMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SendMessageMiddleware implements MiddlewareInterface, EnvelopeAwareInterfa
2727
private $senderLocator;
2828
private $messagesToSendAndHandleMapping;
2929

30-
public function __construct(SenderLocatorInterface $senderLocator, array $messagesToSendAndHandleMapping = array())
30+
public function __construct(SenderLocatorInterface $senderLocator, array $messagesToSendAndHandleMapping = [])
3131
{
3232
$this->senderLocator = $senderLocator;
3333
$this->messagesToSendAndHandleMapping = $messagesToSendAndHandleMapping;

Command/ConsumeMessagesCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ConsumeMessagesCommand extends Command
4040
private $logger;
4141
private $receiverNames;
4242

43-
public function __construct(MessageBusInterface $bus, ContainerInterface $receiverLocator, LoggerInterface $logger = null, array $receiverNames = array())
43+
public function __construct(MessageBusInterface $bus, ContainerInterface $receiverLocator, LoggerInterface $logger = null, array $receiverNames = [])
4444
{
4545
$this->bus = $bus;
4646
$this->receiverLocator = $receiverLocator;
@@ -58,12 +58,12 @@ protected function configure(): void
5858
$defaultReceiverName = 1 === \count($this->receiverNames) ? current($this->receiverNames) : null;
5959

6060
$this
61-
->setDefinition(array(
61+
->setDefinition([
6262
new InputArgument('receiver', $defaultReceiverName ? InputArgument::OPTIONAL : InputArgument::REQUIRED, 'Name of the receiver', $defaultReceiverName),
6363
new InputOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Limit the number of received messages'),
6464
new InputOption('memory-limit', 'm', InputOption::VALUE_REQUIRED, 'The memory limit the worker can consume'),
6565
new InputOption('time-limit', 't', InputOption::VALUE_REQUIRED, 'The time limit in seconds the worker can run'),
66-
))
66+
])
6767
->setDescription('Consumes messages')
6868
->setHelp(<<<'EOF'
6969
The <info>%command.name%</info> command consumes messages and dispatches them to the message bus.
@@ -161,7 +161,7 @@ private function convertToBytes(string $memoryLimit): int
161161

162162
private function findAlternatives($name, array $collection)
163163
{
164-
$alternatives = array();
164+
$alternatives = [];
165165
foreach ($collection as $item) {
166166
$lev = levenshtein($name, $item);
167167
if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {

Command/DebugCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,24 @@ protected function execute(InputInterface $input, OutputInterface $output)
7474
if (!isset($mapping[$bus])) {
7575
throw new RuntimeException(sprintf('Bus "%s" does not exist. Known buses are %s.', $bus, implode(', ', array_keys($this->mapping))));
7676
}
77-
$mapping = array($bus => $mapping[$bus]);
77+
$mapping = [$bus => $mapping[$bus]];
7878
}
7979

8080
foreach ($mapping as $bus => $handlersByMessage) {
8181
$io->section($bus);
8282

83-
$tableRows = array();
83+
$tableRows = [];
8484
foreach ($handlersByMessage as $message => $handlers) {
85-
$tableRows[] = array(sprintf('<fg=cyan>%s</fg=cyan>', $message));
85+
$tableRows[] = [sprintf('<fg=cyan>%s</fg=cyan>', $message)];
8686
foreach ($handlers as $handler) {
87-
$tableRows[] = array(sprintf(' handled by <info>%s</>', $handler));
87+
$tableRows[] = [sprintf(' handled by <info>%s</>', $handler)];
8888
}
8989
}
9090

9191
if ($tableRows) {
9292
$io->text('The following messages can be dispatched:');
9393
$io->newLine();
94-
$io->table(array(), $tableRows);
94+
$io->table([], $tableRows);
9595
} else {
9696
$io->warning(sprintf('No handled message found in bus "%s".', $bus));
9797
}

DataCollector/MessengerDataCollector.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
class MessengerDataCollector extends DataCollector implements LateDataCollectorInterface
2828
{
29-
private $traceableBuses = array();
29+
private $traceableBuses = [];
3030

3131
public function registerBus(string $name, TraceableMessageBus $bus)
3232
{
@@ -46,13 +46,13 @@ public function collect(Request $request, Response $response, \Exception $except
4646
*/
4747
public function lateCollect()
4848
{
49-
$this->data = array('messages' => array(), 'buses' => array_keys($this->traceableBuses));
49+
$this->data = ['messages' => [], 'buses' => array_keys($this->traceableBuses)];
5050

51-
$messages = array();
51+
$messages = [];
5252
foreach ($this->traceableBuses as $busName => $bus) {
5353
foreach ($bus->getDispatchedMessages() as $message) {
5454
$debugRepresentation = $this->cloneVar($this->collectMessage($busName, $message));
55-
$messages[] = array($debugRepresentation, $message['callTime']);
55+
$messages[] = [$debugRepresentation, $message['callTime']];
5656
}
5757
}
5858

@@ -78,7 +78,7 @@ public function getName()
7878
*/
7979
public function reset()
8080
{
81-
$this->data = array();
81+
$this->data = [];
8282
foreach ($this->traceableBuses as $traceableBus) {
8383
$traceableBus->reset();
8484
}
@@ -88,30 +88,30 @@ private function collectMessage(string $busName, array $tracedMessage)
8888
{
8989
$message = $tracedMessage['message'];
9090

91-
$debugRepresentation = array(
91+
$debugRepresentation = [
9292
'bus' => $busName,
9393
'envelopeItems' => $tracedMessage['envelopeItems'] ?? null,
94-
'message' => array(
94+
'message' => [
9595
'type' => new ClassStub(\get_class($message)),
9696
'value' => $message,
97-
),
98-
);
97+
],
98+
];
9999

100100
if (array_key_exists('result', $tracedMessage)) {
101101
$result = $tracedMessage['result'];
102-
$debugRepresentation['result'] = array(
102+
$debugRepresentation['result'] = [
103103
'type' => \is_object($result) ? \get_class($result) : \gettype($result),
104104
'value' => $result,
105-
);
105+
];
106106
}
107107

108108
if (isset($tracedMessage['exception'])) {
109109
$exception = $tracedMessage['exception'];
110110

111-
$debugRepresentation['exception'] = array(
111+
$debugRepresentation['exception'] = [
112112
'type' => \get_class($exception),
113113
'value' => $exception,
114-
);
114+
];
115115
}
116116

117117
return $debugRepresentation;
@@ -126,7 +126,7 @@ public function getExceptionsCount(string $bus = null): int
126126

127127
public function getMessages(string $bus = null): array
128128
{
129-
$messages = $this->data['messages'] ?? array();
129+
$messages = $this->data['messages'] ?? [];
130130

131131
return $bus ? array_filter($messages, function (Data $message) use ($bus): bool {
132132
return $bus === $message['bus'];

DependencyInjection/MessengerPass.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function process(ContainerBuilder $container)
5555
return;
5656
}
5757

58-
$busIds = array();
58+
$busIds = [];
5959
foreach ($container->findTaggedServiceIds($this->busTag) as $busId => $tags) {
6060
$busIds[] = $busId;
6161
if ($container->hasParameter($busMiddlewareParameter = $busId.'.middleware')) {
@@ -76,8 +76,8 @@ public function process(ContainerBuilder $container)
7676

7777
private function registerHandlers(ContainerBuilder $container, array $busIds)
7878
{
79-
$definitions = array();
80-
$handlersByBusAndMessage = array();
79+
$definitions = [];
80+
$handlersByBusAndMessage = [];
8181

8282
foreach ($container->findTaggedServiceIds($this->handlerTag, true) as $serviceId => $tags) {
8383
foreach ($tags as $tag) {
@@ -88,7 +88,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
8888
$r = $container->getReflectionClass($container->getDefinition($serviceId)->getClass());
8989

9090
if (isset($tag['handles'])) {
91-
$handles = isset($tag['method']) ? array($tag['handles'] => $tag['method']) : array($tag['handles']);
91+
$handles = isset($tag['method']) ? [$tag['handles'] => $tag['method']] : [$tag['handles']];
9292
} else {
9393
$handles = $this->guessHandledClasses($r, $serviceId);
9494
}
@@ -125,7 +125,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
125125
}
126126

127127
if ('__invoke' !== $method) {
128-
$wrapperDefinition = (new Definition('callable'))->addArgument(array(new Reference($serviceId), $method))->setFactory('Closure::fromCallable');
128+
$wrapperDefinition = (new Definition('callable'))->addArgument([new Reference($serviceId), $method])->setFactory('Closure::fromCallable');
129129

130130
$definitions[$definitionId = '.messenger.method_on_object_wrapper.'.ContainerBuilder::hash($messageClass.':'.$messagePriority.':'.$serviceId.':'.$method)] = $wrapperDefinition;
131131
} else {
@@ -146,15 +146,15 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
146146
}
147147
}
148148

149-
$handlersLocatorMappingByBus = array();
149+
$handlersLocatorMappingByBus = [];
150150
foreach ($handlersByBusAndMessage as $bus => $handlersByMessage) {
151151
foreach ($handlersByMessage as $message => $handlersIds) {
152152
if (1 === \count($handlersIds)) {
153153
$handlersLocatorMappingByBus[$bus]['handler.'.$message] = new Reference(current($handlersIds));
154154
} else {
155-
$chainHandler = new Definition(ChainHandler::class, array(array_map(function (string $handlerId): Reference {
155+
$chainHandler = new Definition(ChainHandler::class, [array_map(function (string $handlerId): Reference {
156156
return new Reference($handlerId);
157-
}, $handlersIds)));
157+
}, $handlersIds)]);
158158
$chainHandler->setPrivate(true);
159159
$serviceId = '.messenger.chain_handler.'.ContainerBuilder::hash($bus.$message);
160160
$definitions[$serviceId] = $chainHandler;
@@ -166,7 +166,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
166166

167167
foreach ($busIds as $bus) {
168168
$container->register($resolverName = "$bus.messenger.handler_resolver", ContainerHandlerLocator::class)
169-
->setArgument(0, ServiceLocatorTagPass::register($container, $handlersLocatorMappingByBus[$bus] ?? array()))
169+
->setArgument(0, ServiceLocatorTagPass::register($container, $handlersLocatorMappingByBus[$bus] ?? []))
170170
;
171171
if ($container->has($callMessageHandlerId = "$bus.middleware.call_message_handler")) {
172172
$container->getDefinition($callMessageHandlerId)
@@ -179,7 +179,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
179179
$debugCommandMapping = $handlersByBusAndMessage;
180180
foreach ($busIds as $bus) {
181181
if (!isset($debugCommandMapping[$bus])) {
182-
$debugCommandMapping[$bus] = array();
182+
$debugCommandMapping[$bus] = [];
183183
}
184184
}
185185
$container->getDefinition('console.command.messenger_debug')->replaceArgument(0, $debugCommandMapping);
@@ -215,12 +215,12 @@ private function guessHandledClasses(\ReflectionClass $handlerClass, string $ser
215215
throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type));
216216
}
217217

218-
return array((string) $parameters[0]->getType());
218+
return [(string) $parameters[0]->getType()];
219219
}
220220

221221
private function registerReceivers(ContainerBuilder $container)
222222
{
223-
$receiverMapping = array();
223+
$receiverMapping = [];
224224

225225
foreach ($container->findTaggedServiceIds($this->receiverTag) as $id => $tags) {
226226
$receiverClass = $container->findDefinition($id)->getClass();
@@ -238,7 +238,7 @@ private function registerReceivers(ContainerBuilder $container)
238238
}
239239

240240
if ($container->hasDefinition('console.command.messenger_consume_messages')) {
241-
$receiverNames = array();
241+
$receiverNames = [];
242242
foreach ($receiverMapping as $name => $reference) {
243243
$receiverNames[(string) $reference] = $name;
244244
}
@@ -250,7 +250,7 @@ private function registerReceivers(ContainerBuilder $container)
250250

251251
private function registerSenders(ContainerBuilder $container)
252252
{
253-
$senderLocatorMapping = array();
253+
$senderLocatorMapping = [];
254254
foreach ($container->findTaggedServiceIds($this->senderTag) as $id => $tags) {
255255
$senderClass = $container->findDefinition($id)->getClass();
256256
if (!is_subclass_of($senderClass, SenderInterface::class)) {
@@ -273,18 +273,18 @@ private function registerBusToCollector(ContainerBuilder $container, string $bus
273273
{
274274
$container->setDefinition(
275275
$tracedBusId = 'debug.traced.'.$busId,
276-
(new Definition(TraceableMessageBus::class, array(new Reference($tracedBusId.'.inner'))))->setDecoratedService($busId)
276+
(new Definition(TraceableMessageBus::class, [new Reference($tracedBusId.'.inner')]))->setDecoratedService($busId)
277277
);
278278

279-
$container->getDefinition('data_collector.messenger')->addMethodCall('registerBus', array($busId, new Reference($tracedBusId)));
279+
$container->getDefinition('data_collector.messenger')->addMethodCall('registerBus', [$busId, new Reference($tracedBusId)]);
280280
}
281281

282282
private function registerBusMiddleware(ContainerBuilder $container, string $busId, array $middlewareCollection)
283283
{
284-
$middlewareReferences = array();
284+
$middlewareReferences = [];
285285
foreach ($middlewareCollection as $middlewareItem) {
286286
$id = $middlewareItem['id'];
287-
$arguments = $middlewareItem['arguments'] ?? array();
287+
$arguments = $middlewareItem['arguments'] ?? [];
288288
if (!$container->has($messengerMiddlewareId = 'messenger.middleware.'.$id)) {
289289
$messengerMiddlewareId = $id;
290290
}
@@ -296,7 +296,7 @@ private function registerBusMiddleware(ContainerBuilder $container, string $busI
296296
if (($definition = $container->findDefinition($messengerMiddlewareId))->isAbstract()) {
297297
$childDefinition = new ChildDefinition($messengerMiddlewareId);
298298
$count = \count($definition->getArguments());
299-
foreach (array_values($arguments ?? array()) as $key => $argument) {
299+
foreach (array_values($arguments ?? []) as $key => $argument) {
300300
// Parent definition can provide default arguments.
301301
// Replace each explicitly or add if not set:
302302
$key < $count ? $childDefinition->replaceArgument($key, $argument) : $childDefinition->addArgument($argument);

Envelope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
*/
2121
final class Envelope
2222
{
23-
private $items = array();
23+
private $items = [];
2424
private $message;
2525

2626
/**
2727
* @param object $message
2828
* @param EnvelopeItemInterface[] $items
2929
*/
30-
public function __construct($message, array $items = array())
30+
public function __construct($message, array $items = [])
3131
{
3232
$this->message = $message;
3333
foreach ($items as $item) {

Handler/ChainHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(array $handlers)
3737

3838
public function __invoke($message)
3939
{
40-
$results = array();
40+
$results = [];
4141

4242
foreach ($this->handlers as $handler) {
4343
$results[] = $handler($message);

Handler/Locator/HandlerLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class HandlerLocator implements HandlerLocatorInterface
2323
*/
2424
private $messageToHandlerMapping;
2525

26-
public function __construct(array $messageToHandlerMapping = array())
26+
public function __construct(array $messageToHandlerMapping = [])
2727
{
2828
$this->messageToHandlerMapping = $messageToHandlerMapping;
2929
}

MessageBus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MessageBus implements MessageBusInterface
3030
/**
3131
* @param MiddlewareInterface[]|iterable $middlewareHandlers
3232
*/
33-
public function __construct(iterable $middlewareHandlers = array())
33+
public function __construct(iterable $middlewareHandlers = [])
3434
{
3535
$this->middlewareHandlers = $middlewareHandlers;
3636
}

Middleware/Configuration/ValidationConfiguration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ public function serialize()
4040
{
4141
$isGroupSequence = $this->groups instanceof GroupSequence;
4242

43-
return serialize(array(
43+
return serialize([
4444
'groups' => $isGroupSequence ? $this->groups->groups : $this->groups,
4545
'is_group_sequence' => $isGroupSequence,
46-
));
46+
]);
4747
}
4848

4949
public function unserialize($serialized)
5050
{
5151
list(
5252
'groups' => $groups,
5353
'is_group_sequence' => $isGroupSequence
54-
) = unserialize($serialized, array('allowed_classes' => false));
54+
) = unserialize($serialized, ['allowed_classes' => false]);
5555

5656
$this->__construct($isGroupSequence ? new GroupSequence($groups) : $groups);
5757
}

0 commit comments

Comments
 (0)