@@ -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 );
0 commit comments