From c8bc1fa91e076b716a34972f97ed93d21fc500a0 Mon Sep 17 00:00:00 2001 From: Iman Ghafoori Date: Fri, 21 Jan 2022 03:30:33 +0330 Subject: [PATCH] fix event:list (cherry picked from commit 96eb3678c0d3211b33c87bed373900b55f5266ad) (cherry picked from commit 42927f484568a4fb9372dc72737f883a18ab8d7c) --- .../Foundation/Console/EventListCommand.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Foundation/Console/EventListCommand.php b/src/Illuminate/Foundation/Console/EventListCommand.php index 275924e8c6d5..11fa79ecccd3 100644 --- a/src/Illuminate/Foundation/Console/EventListCommand.php +++ b/src/Illuminate/Foundation/Console/EventListCommand.php @@ -55,9 +55,7 @@ public function handle() */ protected function getEvents() { - $events = []; - - $events = $this->addListenersOnDispatcher($events); + $events = $this->getListenersOnDispatcher(); if ($this->filteringByEvent()) { $events = $this->filterEvents($events); @@ -69,19 +67,24 @@ protected function getEvents() } /** - * Adds the event / listeners on the dispatcher object to the given list. + * Get the event / listeners from the dispatcher object. * - * @param array $events * @return array */ - protected function addListenersOnDispatcher(array $events) + protected function getListenersOnDispatcher() { + $events = []; foreach ($this->getRawListeners() as $event => $rawListeners) { foreach ($rawListeners as $rawListener) { if (is_string($rawListener)) { $events[$event][] = $rawListener; } elseif ($rawListener instanceof Closure) { $events[$event][] = $this->stringifyClosure($rawListener); + } elseif (is_array($rawListener) && count($rawListener) === 2) { + if (is_object($rawListener[0])) { + $rawListener[0] = get_class($rawListener[0]); + } + $events[$event][] = implode('@', $rawListener); } } }