@@ -47,7 +47,7 @@ public function __construct(string $handlerTag = 'messenger.message_handler', st
4747 */
4848 public function process (ContainerBuilder $ container )
4949 {
50- $ busIds = array () ;
50+ $ busIds = [] ;
5151 foreach ($ container ->findTaggedServiceIds ($ this ->busTag ) as $ busId => $ tags ) {
5252 $ busIds [] = $ busId ;
5353 if ($ container ->hasParameter ($ busMiddlewareParameter = $ busId .'.middleware ' )) {
@@ -69,8 +69,8 @@ public function process(ContainerBuilder $container)
6969
7070 private function registerHandlers (ContainerBuilder $ container , array $ busIds )
7171 {
72- $ definitions = array () ;
73- $ handlersByBusAndMessage = array () ;
72+ $ definitions = [] ;
73+ $ handlersByBusAndMessage = [] ;
7474
7575 foreach ($ container ->findTaggedServiceIds ($ this ->handlerTag , true ) as $ serviceId => $ tags ) {
7676 foreach ($ tags as $ tag ) {
@@ -86,7 +86,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
8686 }
8787
8888 if (isset ($ tag ['handles ' ])) {
89- $ handles = isset ($ tag ['method ' ]) ? array ( $ tag ['handles ' ] => $ tag ['method ' ]) : array ( $ tag ['handles ' ]) ;
89+ $ handles = isset ($ tag ['method ' ]) ? [ $ tag ['handles ' ] => $ tag ['method ' ]] : [ $ tag ['handles ' ]] ;
9090 } else {
9191 $ handles = $ this ->guessHandledClasses ($ r , $ serviceId );
9292 }
@@ -115,7 +115,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
115115 throw new RuntimeException (sprintf ('Invalid configuration %s for message "%s": bus "%s" does not exist. ' , $ messageLocation , $ message , $ method ['bus ' ]));
116116 }
117117
118- $ buses = array ( $ method ['bus ' ]) ;
118+ $ buses = [ $ method ['bus ' ]] ;
119119 }
120120
121121 $ priority = $ method ['priority ' ] ?? $ priority ;
@@ -133,7 +133,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
133133 }
134134
135135 if ('__invoke ' !== $ method ) {
136- $ wrapperDefinition = (new Definition ('callable ' ))->addArgument (array ( new Reference ($ serviceId ), $ method) )->setFactory ('Closure::fromCallable ' );
136+ $ wrapperDefinition = (new Definition ('callable ' ))->addArgument ([ new Reference ($ serviceId ), $ method] )->setFactory ('Closure::fromCallable ' );
137137
138138 $ definitions [$ definitionId = '.messenger.method_on_object_wrapper. ' .ContainerBuilder::hash ($ message .': ' .$ priority .': ' .$ serviceId .': ' .$ method )] = $ wrapperDefinition ;
139139 } else {
@@ -158,7 +158,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
158158 }
159159 }
160160
161- $ handlersLocatorMappingByBus = array () ;
161+ $ handlersLocatorMappingByBus = [] ;
162162 foreach ($ handlersByBusAndMessage as $ bus => $ handlersByMessage ) {
163163 foreach ($ handlersByMessage as $ message => $ handlerIds ) {
164164 $ handlers = array_map (function (string $ handlerId ) { return new Reference ($ handlerId ); }, $ handlerIds );
@@ -169,7 +169,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
169169
170170 foreach ($ busIds as $ bus ) {
171171 $ container ->register ($ locatorId = $ bus .'.messenger.handlers_locator ' , HandlersLocator::class)
172- ->setArgument (0 , $ handlersLocatorMappingByBus [$ bus ] ?? array () )
172+ ->setArgument (0 , $ handlersLocatorMappingByBus [$ bus ] ?? [] )
173173 ;
174174 if ($ container ->has ($ handleMessageId = $ bus .'.middleware.handle_message ' )) {
175175 $ container ->getDefinition ($ handleMessageId )
@@ -182,7 +182,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
182182 $ debugCommandMapping = $ handlersByBusAndMessage ;
183183 foreach ($ busIds as $ bus ) {
184184 if (!isset ($ debugCommandMapping [$ bus ])) {
185- $ debugCommandMapping [$ bus ] = array () ;
185+ $ debugCommandMapping [$ bus ] = [] ;
186186 }
187187 }
188188 $ container ->getDefinition ('console.command.messenger_debug ' )->replaceArgument (0 , $ debugCommandMapping );
@@ -214,12 +214,12 @@ private function guessHandledClasses(\ReflectionClass $handlerClass, string $ser
214214 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 ));
215215 }
216216
217- return array (( string ) $ parameters [0 ]->getType ()) ;
217+ return [( string ) $ parameters [0 ]->getType ()] ;
218218 }
219219
220220 private function registerReceivers (ContainerBuilder $ container , array $ busIds )
221221 {
222- $ receiverMapping = array () ;
222+ $ receiverMapping = [] ;
223223
224224 foreach ($ container ->findTaggedServiceIds ($ this ->receiverTag ) as $ id => $ tags ) {
225225 $ receiverClass = $ container ->findDefinition ($ id )->getClass ();
@@ -237,11 +237,11 @@ private function registerReceivers(ContainerBuilder $container, array $busIds)
237237 }
238238
239239 if ($ container ->hasDefinition ('console.command.messenger_consume_messages ' )) {
240- $ receiverNames = array () ;
240+ $ receiverNames = [] ;
241241 foreach ($ receiverMapping as $ name => $ reference ) {
242242 $ receiverNames [(string ) $ reference ] = $ name ;
243243 }
244- $ buses = array () ;
244+ $ buses = [] ;
245245 foreach ($ busIds as $ busId ) {
246246 $ buses [$ busId ] = new Reference ($ busId );
247247 }
@@ -259,18 +259,18 @@ private function registerBusToCollector(ContainerBuilder $container, string $bus
259259 {
260260 $ container ->setDefinition (
261261 $ tracedBusId = 'debug.traced. ' .$ busId ,
262- (new Definition (TraceableMessageBus::class, array ( new Reference ($ tracedBusId .'.inner ' )) ))->setDecoratedService ($ busId )
262+ (new Definition (TraceableMessageBus::class, [ new Reference ($ tracedBusId .'.inner ' )] ))->setDecoratedService ($ busId )
263263 );
264264
265- $ container ->getDefinition ('data_collector.messenger ' )->addMethodCall ('registerBus ' , array ( $ busId , new Reference ($ tracedBusId )) );
265+ $ container ->getDefinition ('data_collector.messenger ' )->addMethodCall ('registerBus ' , [ $ busId , new Reference ($ tracedBusId )] );
266266 }
267267
268268 private function registerBusMiddleware (ContainerBuilder $ container , string $ busId , array $ middlewareCollection )
269269 {
270- $ middlewareReferences = array () ;
270+ $ middlewareReferences = [] ;
271271 foreach ($ middlewareCollection as $ middlewareItem ) {
272272 $ id = $ middlewareItem ['id ' ];
273- $ arguments = $ middlewareItem ['arguments ' ] ?? array () ;
273+ $ arguments = $ middlewareItem ['arguments ' ] ?? [] ;
274274 if (!$ container ->has ($ messengerMiddlewareId = 'messenger.middleware. ' .$ id )) {
275275 $ messengerMiddlewareId = $ id ;
276276 }
0 commit comments