diff --git a/range.module b/range.module
index 8fa9542..b9ca923 100644
--- a/range.module
+++ b/range.module
@@ -5,59 +5,25 @@
  * Defines a numeric range field type.
  */
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\range\Hook\RangeHooks;
 use Drupal\Component\Utility\DeprecationHelper;
 use Drupal\field\FieldStorageConfigInterface;
 
 /**
  * Implements hook_theme().
  */
+#[LegacyHook]
 function range_theme() {
-  return [
-    'range_formatter_range_combined' => [
-      'variables' => [
-        'item' => NULL,
-        'field_prefix' => NULL,
-        'value_prefix' => NULL,
-        'value' => NULL,
-        'value_suffix' => NULL,
-        'field_suffix' => NULL,
-      ],
-    ],
-    'range_formatter_range_separate' => [
-      'variables' => [
-        'item' => NULL,
-        'field_prefix' => NULL,
-        'from_prefix' => NULL,
-        'from' => NULL,
-        'from_suffix' => NULL,
-        'range_separator' => NULL,
-        'to_prefix' => NULL,
-        'to' => NULL,
-        'to_suffix' => NULL,
-        'field_suffix' => NULL,
-      ],
-    ],
-  ];
+  return \Drupal::service(RangeHooks::class)->theme();
 }
 
 /**
  * Implements hook_field_views_data().
  */
+#[LegacyHook]
 function range_field_views_data(FieldStorageConfigInterface $field_storage) {
-  $data = DeprecationHelper::backwardsCompatibleCall(
-    currentVersion: \Drupal::VERSION,
-    deprecatedVersion: '11.2',
-    currentCallable: fn() => \Drupal::service('views.field_data_provider')->defaultFieldImplementation($field_storage),
-    // @phpstan-ignore function.notFound
-    deprecatedCallable: fn() => views_field_default_views_data($field_storage),
-  );
-
-  if (!empty($data)) {
-    range_field_views_data_filter($data, $field_storage);
-    range_field_views_data_argument($data, $field_storage);
-  }
-
-  return $data;
+  return \Drupal::service(RangeHooks::class)->fieldViewsData($field_storage);
 }
 
 /**
diff --git a/range.services.yml b/range.services.yml
new file mode 100644
index 0000000..11bd7d8
--- /dev/null
+++ b/range.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\range\Hook\RangeHooks:
+    class: Drupal\range\Hook\RangeHooks
+    autowire: true
diff --git a/src/Hook/RangeHooks.php b/src/Hook/RangeHooks.php
new file mode 100644
index 0000000..9d7ce7a
--- /dev/null
+++ b/src/Hook/RangeHooks.php
@@ -0,0 +1,66 @@
+<?php
+
+namespace Drupal\range\Hook;
+
+use Drupal\Component\Utility\DeprecationHelper;
+use Drupal\field\FieldStorageConfigInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+
+/**
+ * Hook implementations for range.
+ */
+class RangeHooks {
+
+  /**
+   * Implements hook_theme().
+   */
+  #[Hook('theme')]
+  public function theme() {
+    return [
+      'range_formatter_range_combined' => [
+        'variables' => [
+          'item' => NULL,
+          'field_prefix' => NULL,
+          'value_prefix' => NULL,
+          'value' => NULL,
+          'value_suffix' => NULL,
+          'field_suffix' => NULL,
+        ],
+      ],
+      'range_formatter_range_separate' => [
+        'variables' => [
+          'item' => NULL,
+          'field_prefix' => NULL,
+          'from_prefix' => NULL,
+          'from' => NULL,
+          'from_suffix' => NULL,
+          'range_separator' => NULL,
+          'to_prefix' => NULL,
+          'to' => NULL,
+          'to_suffix' => NULL,
+          'field_suffix' => NULL,
+        ],
+      ],
+    ];
+  }
+
+  /**
+   * Implements hook_field_views_data().
+   */
+  #[Hook('field_views_data')]
+  public function fieldViewsData(FieldStorageConfigInterface $field_storage) {
+    $data = DeprecationHelper::backwardsCompatibleCall(
+          currentVersion: \Drupal::VERSION,
+          deprecatedVersion: '11.2',
+          currentCallable: fn() => \Drupal::service('views.field_data_provider')->defaultFieldImplementation($field_storage),
+          // @phpstan-ignore function.notFound
+          deprecatedCallable: fn() => views_field_default_views_data($field_storage)
+      );
+    if (!empty($data)) {
+      range_field_views_data_filter($data, $field_storage);
+      range_field_views_data_argument($data, $field_storage);
+    }
+    return $data;
+  }
+
+}
diff --git a/src/Plugin/Validation/Constraint/RangeBothValuesRequiredConstraintValidator.php b/src/Plugin/Validation/Constraint/RangeBothValuesRequiredConstraintValidator.php
index 2f9269d..e5417bb 100644
--- a/src/Plugin/Validation/Constraint/RangeBothValuesRequiredConstraintValidator.php
+++ b/src/Plugin/Validation/Constraint/RangeBothValuesRequiredConstraintValidator.php
@@ -15,7 +15,7 @@ class RangeBothValuesRequiredConstraintValidator extends ConstraintValidator {
   /**
    * {@inheritdoc}
    */
-  public function validate($value, Constraint $constraint): void {
+  public function validate(mixed $value, Constraint $constraint): void {
     if (!($value instanceof RangeItemInterface)) {
       throw new UnexpectedTypeException($value, 'RangeItemInterface');
     }
diff --git a/src/Plugin/Validation/Constraint/RangeFromGreaterToConstraintValidator.php b/src/Plugin/Validation/Constraint/RangeFromGreaterToConstraintValidator.php
index bdd4d83..270f0c3 100644
--- a/src/Plugin/Validation/Constraint/RangeFromGreaterToConstraintValidator.php
+++ b/src/Plugin/Validation/Constraint/RangeFromGreaterToConstraintValidator.php
@@ -15,7 +15,7 @@ class RangeFromGreaterToConstraintValidator extends ConstraintValidator {
   /**
    * {@inheritdoc}
    */
-  public function validate($value, Constraint $constraint): void {
+  public function validate(mixed $value, Constraint $constraint): void {
     if (!($value instanceof RangeItemInterface)) {
       throw new UnexpectedTypeException($value, 'RangeItemInterface');
     }
