Skip to content

Commit 7594267

Browse files
committed
allow array based event listeners again
1 parent 019185e commit 7594267

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Illuminate/Events/Dispatcher.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ public function makeListener($listener, $wildcard = false)
369369
return $this->createClassListener($listener, $wildcard);
370370
}
371371

372+
if (is_array($listener) && isset($listener[0]) && is_string($listener[0])) {
373+
return $this->createClassListener($listener, $wildcard);
374+
}
375+
372376
return function ($event, $payload) use ($listener, $wildcard) {
373377
if ($wildcard) {
374378
return $listener($event, $payload);
@@ -401,12 +405,14 @@ public function createClassListener($listener, $wildcard = false)
401405
/**
402406
* Create the class based event callable.
403407
*
404-
* @param string $listener
408+
* @param array|string $listener
405409
* @return callable
406410
*/
407411
protected function createClassCallable($listener)
408412
{
409-
[$class, $method] = $this->parseClassCallable($listener);
413+
[$class, $method] = is_array($listener)
414+
? $listener
415+
: $this->parseClassCallable($listener);
410416

411417
if ($this->handlerShouldBeQueued($class)) {
412418
return $this->createQueuedHandlerCallable($class, $method);

0 commit comments

Comments
 (0)