From 2344f2f9a950a1c50f61bdc52ae68bd2ef62ca91 Mon Sep 17 00:00:00 2001
From: Steven Luongo <luongosb@gmail.com>
Date: Tue, 22 Apr 2025 07:59:16 -0400
Subject: [PATCH 1/3] Issue #3520482 by vetchneons: Drupal 11 Upgrade

---
 js_component.info.yml                                  | 2 +-
 src/EventSubscriber/JSComponentBuildEventSubscribe.php | 2 +-
 src/Plugin/Block/JSComponentBlockType.php              | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/js_component.info.yml b/js_component.info.yml
index 7a6f1b6..0f71343 100644
--- a/js_component.info.yml
+++ b/js_component.info.yml
@@ -1,5 +1,5 @@
 type: module
 name: JS Component
 description: Define JS components as custom blocks from a theme or module.
-core_version_requirement: ^8.7.7 || ^9
+core_version_requirement: ^10.1 || ^11
 package: Other
diff --git a/src/EventSubscriber/JSComponentBuildEventSubscribe.php b/src/EventSubscriber/JSComponentBuildEventSubscribe.php
index 3b5a8d4..a6343af 100644
--- a/src/EventSubscriber/JSComponentBuildEventSubscribe.php
+++ b/src/EventSubscriber/JSComponentBuildEventSubscribe.php
@@ -14,7 +14,7 @@ class JSComponentBuildEventSubscribe implements EventSubscriberInterface {
   /**
    * {@inheritDoc}
    */
-  public static function getSubscribedEvents() {
+  public static function getSubscribedEvents(): array {
     return [
       Events::BUILD_COMPONENT_DATA => [
         ['buildJSComponentData'],
diff --git a/src/Plugin/Block/JSComponentBlockType.php b/src/Plugin/Block/JSComponentBlockType.php
index 8dbd3f5..7d9122d 100644
--- a/src/Plugin/Block/JSComponentBlockType.php
+++ b/src/Plugin/Block/JSComponentBlockType.php
@@ -218,7 +218,7 @@ class JSComponentBlockType extends BlockBase implements ContainerFactoryPluginIn
         $build += $this->buildComponentInlineTemplate();
       }
     } catch (\Exception $exception) {
-      watchdog_exception('js_component', $exception);
+      \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.1.0', fn() => \Drupal\Core\Utility\Error::logException(\Drupal::logger('js_component'), $exception), fn() => watchdog_exception('js_component', $exception));
     }
 
     return $build;
@@ -392,7 +392,7 @@ class JSComponentBlockType extends BlockBase implements ContainerFactoryPluginIn
         $subform_state
       ]);
     } catch (\Exception $exception) {
-      watchdog_exception('js_component', $exception);
+      \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.1.0', fn() => \Drupal\Core\Utility\Error::logException(\Drupal::logger('js_component'), $exception), fn() => watchdog_exception('js_component', $exception));
     }
 
     return $values;
-- 
GitLab


From ff477b679112303bb62f92cb8a56c2c22a85e409 Mon Sep 17 00:00:00 2001
From: Steven Luongo <luongosb@gmail.com>
Date: Tue, 22 Apr 2025 08:07:47 -0400
Subject: [PATCH 2/3] Issue #3520482 by vetchneons: replace deprecated
 watchdog_exception with \Drupal\Core\Utility\Error

---
 src/Plugin/Block/JSComponentBlockType.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/Plugin/Block/JSComponentBlockType.php b/src/Plugin/Block/JSComponentBlockType.php
index 7d9122d..d038c41 100644
--- a/src/Plugin/Block/JSComponentBlockType.php
+++ b/src/Plugin/Block/JSComponentBlockType.php
@@ -26,7 +26,7 @@ use Drupal\Core\Render\ElementInfoManagerInterface;
 use Drupal\js_component\JSComponentManagerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-
+use Drupal\Core\Utility\Error;
 /**
  * Define JS component block.
  *
@@ -218,7 +218,8 @@ class JSComponentBlockType extends BlockBase implements ContainerFactoryPluginIn
         $build += $this->buildComponentInlineTemplate();
       }
     } catch (\Exception $exception) {
-      \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.1.0', fn() => \Drupal\Core\Utility\Error::logException(\Drupal::logger('js_component'), $exception), fn() => watchdog_exception('js_component', $exception));
+      $logger = \Drupal::logger('js_component');
+      Error::logException($logger, $exception);
     }
 
     return $build;
@@ -392,7 +393,8 @@ class JSComponentBlockType extends BlockBase implements ContainerFactoryPluginIn
         $subform_state
       ]);
     } catch (\Exception $exception) {
-      \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.1.0', fn() => \Drupal\Core\Utility\Error::logException(\Drupal::logger('js_component'), $exception), fn() => watchdog_exception('js_component', $exception));
+      $logger = \Drupal::logger('js_component');
+      Error::logException($logger, $exception);
     }
 
     return $values;
-- 
GitLab


From bc8d75dc1577ecf8a5d71bb6077c87073797f7aa Mon Sep 17 00:00:00 2001
From: Steven Luongo <luongosb@gmail.com>
Date: Tue, 22 Apr 2025 08:20:40 -0400
Subject: [PATCH 3/3] #3520482: Added space between comment and use statements.

---
 src/Plugin/Block/JSComponentBlockType.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/Plugin/Block/JSComponentBlockType.php b/src/Plugin/Block/JSComponentBlockType.php
index d038c41..c655847 100644
--- a/src/Plugin/Block/JSComponentBlockType.php
+++ b/src/Plugin/Block/JSComponentBlockType.php
@@ -27,6 +27,7 @@ use Drupal\js_component\JSComponentManagerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Drupal\Core\Utility\Error;
+
 /**
  * Define JS component block.
  *
-- 
GitLab