From 788fdc746049a922e12324e78f6223f771687145 Mon Sep 17 00:00:00 2001
From: Jelle Sebreghts <sebreghts.jelle@gmail.com>
Date: Fri, 21 Jun 2024 11:44:20 +0200
Subject: [PATCH] Issue #3456138: Fix call to undefined method

Call to undefined method
Drupal\\hook_event_dispatcher\\HookEventDispatcherModuleHandler
in DrupalKernel.php on line 723.
---
 src/HookEventDispatcherModuleHandler.php           |  3 ++-
 src/HookEventDispatcherModuleHandlerProxyTrait.php | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/HookEventDispatcherModuleHandler.php b/src/HookEventDispatcherModuleHandler.php
index b38a18d3..ac70f2f2 100644
--- a/src/HookEventDispatcherModuleHandler.php
+++ b/src/HookEventDispatcherModuleHandler.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace Drupal\hook_event_dispatcher;
 
 use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\DestructableInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\hook_event_dispatcher\Event\HookReturnInterface;
 use Drupal\hook_event_dispatcher\Manager\HookEventDispatcherManager;
@@ -12,7 +13,7 @@ use Drupal\hook_event_dispatcher\Manager\HookEventDispatcherManager;
 /**
  * Hook event dispatcher module handler decorator.
  */
-final class HookEventDispatcherModuleHandler implements ModuleHandlerInterface {
+final class HookEventDispatcherModuleHandler implements ModuleHandlerInterface, DestructableInterface {
 
   use HookEventDispatcherModuleHandlerProxyTrait;
 
diff --git a/src/HookEventDispatcherModuleHandlerProxyTrait.php b/src/HookEventDispatcherModuleHandlerProxyTrait.php
index 8791ddc7..3905d3e5 100644
--- a/src/HookEventDispatcherModuleHandlerProxyTrait.php
+++ b/src/HookEventDispatcherModuleHandlerProxyTrait.php
@@ -4,6 +4,8 @@ declare(strict_types=1);
 
 namespace Drupal\hook_event_dispatcher;
 
+use Drupal\Core\DestructableInterface;
+
 /**
  * Implements all methods from the interface via a proxy.
  */
@@ -191,4 +193,13 @@ trait HookEventDispatcherModuleHandlerProxyTrait {
     return $this->inner->getName($module);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function destruct() {
+    if ($this->inner instanceof DestructableInterface) {
+      $this->inner->destruct();
+    }
+  }
+
 }
-- 
GitLab

