diff --git a/core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module b/core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module
deleted file mode 100644
index aa52b6444ae496e38688b6ec290b9e9b2826dd2c..0000000000000000000000000000000000000000
--- a/core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/**
- * @file
- * Implements hooks for the CKEditor 5 Drupal Element Style Test module.
- */
-
-declare(strict_types=1);
-
-use Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition;
-
-// cspell:ignore drupalelementstyle
-
-/**
- * Implements hook_ckeditor4to5upgrade_plugin_info_alter().
- */
-function ckeditor5_drupalelementstyle_test_ckeditor5_plugin_info_alter(array &$plugin_definitions): void {
-  // Update `media_mediaAlign`.
-  assert($plugin_definitions['media_mediaAlign'] instanceof CKEditor5PluginDefinition);
-  $media_align_plugin_definition = $plugin_definitions['media_mediaAlign']->toArray();
-  $media_align_plugin_definition['ckeditor5']['config']['drupalMedia']['toolbar'] = [
-    0 => [
-      'name' => 'drupalMedia:align',
-      'title' => 'Test title',
-      'display' => 'splitButton',
-      'items' => array_values(array_filter($media_align_plugin_definition['ckeditor5']['config']['drupalMedia']['toolbar'], function (string $toolbar_item): bool {
-        return $toolbar_item !== '|';
-      })),
-      'defaultItem' => 'drupalElementStyle:align:breakText',
-    ],
-  ];
-  $plugin_definitions['media_mediaAlign'] = new CKEditor5PluginDefinition($media_align_plugin_definition);
-}
diff --git a/core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/src/Hook/Ckeditor5DrupalElementStyleTestHooks.php b/core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/src/Hook/Ckeditor5DrupalElementStyleTestHooks.php
new file mode 100644
index 0000000000000000000000000000000000000000..45f5265b87a951aa7ddddc290a81479739194314
--- /dev/null
+++ b/core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/src/Hook/Ckeditor5DrupalElementStyleTestHooks.php
@@ -0,0 +1,39 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\ckeditor5_drupalelementstyle_test\Hook;
+
+use Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition;
+use Drupal\Core\Hook\Attribute\Hook;
+
+// cspell:ignore drupalelementstyle
+
+/**
+ * Hook implementations for ckeditor5_drupalelementstyle_test.
+ */
+class Ckeditor5DrupalElementStyleTestHooks {
+
+  /**
+   * Implements hook_ckeditor5_plugin_info_alter().
+   */
+  #[Hook('ckeditor5_plugin_info_alter')]
+  public function ckeditor5PluginInfoAlter(array &$plugin_definitions): void {
+    // Update `media_mediaAlign`.
+    assert($plugin_definitions['media_mediaAlign'] instanceof CKEditor5PluginDefinition);
+    $media_align_plugin_definition = $plugin_definitions['media_mediaAlign']->toArray();
+    $media_align_plugin_definition['ckeditor5']['config']['drupalMedia']['toolbar'] = [
+      0 => [
+        'name' => 'drupalMedia:align',
+        'title' => 'Test title',
+        'display' => 'splitButton',
+        'items' => array_values(array_filter($media_align_plugin_definition['ckeditor5']['config']['drupalMedia']['toolbar'], function (string $toolbar_item): bool {
+          return $toolbar_item !== '|';
+        })),
+        'defaultItem' => 'drupalElementStyle:align:breakText',
+      ],
+    ];
+    $plugin_definitions['media_mediaAlign'] = new CKEditor5PluginDefinition($media_align_plugin_definition);
+  }
+
+}