@@ -106,7 +106,7 @@ public function getSharedManager()
106
106
public function attach ($ eventName , callable $ listener , $ priority = 1 )
107
107
{
108
108
$ this ->events [$ eventName ][(int ) $ priority . '.0 ' ][] = $ listener ;
109
- $ this ->orderedByPriority = false ;
109
+ $ this ->orderedByPriority = false ;
110
110
111
111
return $ listener ;
112
112
}
@@ -190,7 +190,7 @@ public function trigger($eventName, EventInterface $event = null, callable $call
190
190
$ event = $ event ?: new Event ();
191
191
$ event ->stopPropagation (false );
192
192
193
- $ responses = array () ;
193
+ $ responses = [] ;
194
194
$ listeners = $ this ->getListeners ($ eventName );
195
195
196
196
foreach ($ listeners as $ listenersByPriority ) {
@@ -223,14 +223,15 @@ public function getEventNames()
223
223
*/
224
224
public function getListeners ($ eventName )
225
225
{
226
- $ listeners = $ wildcardListeners = $ sharedListeners = array () ;
226
+ $ listeners = $ wildcardListeners = $ sharedListeners = [] ;
227
227
$ mergeCount = 0 ;
228
228
229
229
// pre-order all listeners by priority
230
230
if (!$ this ->orderedByPriority ) {
231
- foreach ($ this ->events as & $ listenersByPriority ) {
232
- krsort ($ listenersByPriority , \ SORT_NUMERIC );
231
+ foreach ($ this ->events as &$ listenersByPriority ) {
232
+ krsort ($ listenersByPriority , SORT_NUMERIC );
233
233
}
234
+
234
235
$ this ->orderedByPriority = true ;
235
236
}
236
237
@@ -243,14 +244,16 @@ public function getListeners($eventName)
243
244
++$ mergeCount ;
244
245
}
245
246
246
- if (null !== $ this ->sharedManager && ($ sharedListeners = $ this ->sharedManager ->getListeners ($ this ->identifiers , $ eventName ))) {
247
+ if (null !== $ this ->sharedManager
248
+ && ($ sharedListeners = $ this ->sharedManager ->getListeners ($ this ->identifiers , $ eventName ))
249
+ ) {
247
250
++$ mergeCount ;
248
251
}
249
252
250
253
// merge
251
254
if ($ mergeCount > 1 ) {
252
255
$ listeners = array_merge_recursive ($ listeners , $ wildcardListeners , $ sharedListeners );
253
- krsort ($ listeners , \ SORT_NUMERIC );
256
+ krsort ($ listeners , SORT_NUMERIC );
254
257
} else {
255
258
$ listeners = $ listeners ?: $ wildcardListeners ?: $ sharedListeners ;
256
259
}
0 commit comments