From 4ecb32b63f51cb4c3991b24df31fbf32b5f8ecd7 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Wed, 5 Aug 2020 18:35:42 +0100 Subject: [PATCH] Support overriding here too --- src/EventServiceProviderTrait.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/EventServiceProviderTrait.php b/src/EventServiceProviderTrait.php index 03797b9..ebef5d6 100644 --- a/src/EventServiceProviderTrait.php +++ b/src/EventServiceProviderTrait.php @@ -92,12 +92,14 @@ protected function getListenerMap() { $class = $this->getServiceProviderClass($this->app); - $reflection = new ReflectionClass($class); - - $property = $reflection->getProperty('listen'); + return $this->getEventListeners(new $class($this->app)); + } + protected function getEventListeners($provider) + { + $property = (new ReflectionClass($provider))->getProperty('listen'); $property->setAccessible(true); - return $property->getValue(new $class($this->app)); + return $property->getValue($provider); } }