@@ -30,12 +30,12 @@ class ContainerAwareEventDispatcher extends EventDispatcher
30
30
/**
31
31
* The service IDs of the event listeners and subscribers.
32
32
*/
33
- private $ listenerIds = array () ;
33
+ private $ listenerIds = [] ;
34
34
35
35
/**
36
36
* The services registered as listeners.
37
37
*/
38
- private $ listeners = array () ;
38
+ private $ listeners = [] ;
39
39
40
40
public function __construct (ContainerInterface $ container )
41
41
{
@@ -70,7 +70,7 @@ public function addListenerService($eventName, $callback, $priority = 0)
70
70
throw new \InvalidArgumentException ('Expected an array("service", "method") argument ' );
71
71
}
72
72
73
- $ this ->listenerIds [$ eventName ][] = array ( $ callback [0 ], $ callback [1 ], $ priority) ;
73
+ $ this ->listenerIds [$ eventName ][] = [ $ callback [0 ], $ callback [1 ], $ priority] ;
74
74
}
75
75
76
76
public function removeListener ($ eventName , $ listener )
@@ -80,7 +80,7 @@ public function removeListener($eventName, $listener)
80
80
if (isset ($ this ->listenerIds [$ eventName ])) {
81
81
foreach ($ this ->listenerIds [$ eventName ] as $ i => list ($ serviceId , $ method )) {
82
82
$ key = $ serviceId .'. ' .$ method ;
83
- if (isset ($ this ->listeners [$ eventName ][$ key ]) && $ listener === array ( $ this ->listeners [$ eventName ][$ key ], $ method) ) {
83
+ if (isset ($ this ->listeners [$ eventName ][$ key ]) && $ listener === [ $ this ->listeners [$ eventName ][$ key ], $ method] ) {
84
84
unset($ this ->listeners [$ eventName ][$ key ]);
85
85
if (empty ($ this ->listeners [$ eventName ])) {
86
86
unset($ this ->listeners [$ eventName ]);
@@ -150,12 +150,12 @@ public function addSubscriberService($serviceId, $class)
150
150
151
151
foreach ($ class ::getSubscribedEvents () as $ eventName => $ params ) {
152
152
if (\is_string ($ params )) {
153
- $ this ->listenerIds [$ eventName ][] = array ( $ serviceId , $ params , 0 ) ;
153
+ $ this ->listenerIds [$ eventName ][] = [ $ serviceId , $ params , 0 ] ;
154
154
} elseif (\is_string ($ params [0 ])) {
155
- $ this ->listenerIds [$ eventName ][] = array ( $ serviceId , $ params [0 ], isset ($ params [1 ]) ? $ params [1 ] : 0 ) ;
155
+ $ this ->listenerIds [$ eventName ][] = [ $ serviceId , $ params [0 ], isset ($ params [1 ]) ? $ params [1 ] : 0 ] ;
156
156
} else {
157
157
foreach ($ params as $ listener ) {
158
- $ this ->listenerIds [$ eventName ][] = array ( $ serviceId , $ listener [0 ], isset ($ listener [1 ]) ? $ listener [1 ] : 0 ) ;
158
+ $ this ->listenerIds [$ eventName ][] = [ $ serviceId , $ listener [0 ], isset ($ listener [1 ]) ? $ listener [1 ] : 0 ] ;
159
159
}
160
160
}
161
161
}
@@ -184,10 +184,10 @@ protected function lazyLoad($eventName)
184
184
185
185
$ key = $ serviceId .'. ' .$ method ;
186
186
if (!isset ($ this ->listeners [$ eventName ][$ key ])) {
187
- $ this ->addListener ($ eventName , array ( $ listener , $ method) , $ priority );
187
+ $ this ->addListener ($ eventName , [ $ listener , $ method] , $ priority );
188
188
} elseif ($ this ->listeners [$ eventName ][$ key ] !== $ listener ) {
189
- parent ::removeListener ($ eventName , array ( $ this ->listeners [$ eventName ][$ key ], $ method) );
190
- $ this ->addListener ($ eventName , array ( $ listener , $ method) , $ priority );
189
+ parent ::removeListener ($ eventName , [ $ this ->listeners [$ eventName ][$ key ], $ method] );
190
+ $ this ->addListener ($ eventName , [ $ listener , $ method] , $ priority );
191
191
}
192
192
193
193
$ this ->listeners [$ eventName ][$ key ] = $ listener ;
0 commit comments