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); } }