diff --git a/migrate_default_content.module b/migrate_default_content.module
index 015f21b..9f689f3 100644
--- a/migrate_default_content.module
+++ b/migrate_default_content.module
@@ -1,16 +1,19 @@
 <?php
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\migrate_default_content\Hook\MigrateDefaultContentHooks;
+
 /**
  * @file
  * Functions for the migrate_default_content module.
  */
-
 /**
  * Implements hook_migration_plugins_alter().
  *
  * Create migrations based on data files.
  */
-function migrate_default_content_migration_plugins_alter(&$definitions) {
-  $mdc_definitions = \Drupal::service('migrate_default_content.migration_generator')->generateMigrations();
-  $definitions = array_merge($definitions, $mdc_definitions);
+#[LegacyHook]
+function migrate_default_content_migration_plugins_alter(&$definitions)
+{
+    \Drupal::service(MigrateDefaultContentHooks::class)->migrationPluginsAlter($definitions);
 }
diff --git a/migrate_default_content.services.yml b/migrate_default_content.services.yml
index 11d3830..532e389 100644
--- a/migrate_default_content.services.yml
+++ b/migrate_default_content.services.yml
@@ -13,3 +13,7 @@ services:
       - '@plugin.manager.field.field_type'
       - '@entity_type.bundle.info'
       - '@logger.factory'
+
+  Drupal\migrate_default_content\Hook\MigrateDefaultContentHooks:
+    class: Drupal\migrate_default_content\Hook\MigrateDefaultContentHooks
+    autowire: true
diff --git a/modules/migrate_default_content_export/migrate_default_content_export.module b/modules/migrate_default_content_export/migrate_default_content_export.module
index d7399b8..90f150d 100644
--- a/modules/migrate_default_content_export/migrate_default_content_export.module
+++ b/modules/migrate_default_content_export/migrate_default_content_export.module
@@ -4,7 +4,8 @@
  * @file
  * Functions for the migrate_default_content_export module.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\migrate_default_content_export\Hook\MigrateDefaultContentExportHooks;
 use Drupal\Core\Form\FormStateInterface;
 
 /**
@@ -13,17 +14,10 @@ use Drupal\Core\Form\FormStateInterface;
  * Alter the migrate_default_content_export_form form
  * to add a new export_dir field.
  */
-function migrate_default_content_export_form_migrate_default_content_settings_alter(&$form, FormStateInterface $form_state, $form_id) {
-  // Set the export_dir field.
-  $form['content_export_dir'] = [
-    '#type' => 'textfield',
-    '#title' => t('Content export directory'),
-    '#default_value' => \Drupal::config('migrate_default_content.settings')->get('content_export_dir'),
-    '#description' => t('The directory where the exported content is stored (relative to the Source directory).'),
-  ];
-
-  // Ensure when the form is submitted, the migration_export_dir is saved.
-  $form['#submit'][] = 'migrate_default_content_export_form_submit';
+#[LegacyHook]
+function migrate_default_content_export_form_migrate_default_content_settings_alter(&$form, FormStateInterface $form_state, $form_id)
+{
+    \Drupal::service(MigrateDefaultContentExportHooks::class)->formMigrateDefaultContentSettingsAlter($form, $form_state, $form_id);
 }
 
 /**
diff --git a/modules/migrate_default_content_export/migrate_default_content_export.services.yml b/modules/migrate_default_content_export/migrate_default_content_export.services.yml
index 2cfc96d..c44b871 100644
--- a/modules/migrate_default_content_export/migrate_default_content_export.services.yml
+++ b/modules/migrate_default_content_export/migrate_default_content_export.services.yml
@@ -6,3 +6,7 @@ services:
   plugin.manager.migrate_default_content_export.export_entity_filter:
     class: Drupal\migrate_default_content_export\ExportEntityFilterPluginManager
     parent: default_plugin_manager
+
+  Drupal\migrate_default_content_export\Hook\MigrateDefaultContentExportHooks:
+    class: Drupal\migrate_default_content_export\Hook\MigrateDefaultContentExportHooks
+    autowire: true
diff --git a/modules/migrate_default_content_export/src/Hook/MigrateDefaultContentExportHooks.php b/modules/migrate_default_content_export/src/Hook/MigrateDefaultContentExportHooks.php
new file mode 100644
index 0000000..84bf2f0
--- /dev/null
+++ b/modules/migrate_default_content_export/src/Hook/MigrateDefaultContentExportHooks.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Drupal\migrate_default_content_export\Hook;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for migrate_default_content_export.
+ */
+class MigrateDefaultContentExportHooks
+{
+    use StringTranslationTrait;
+    /**
+     * Implements hook_form_FORM_ID_alter().
+     *
+     * Alter the migrate_default_content_export_form form
+     * to add a new export_dir field.
+     */
+    #[Hook('form_migrate_default_content_settings_alter')]
+    public function formMigrateDefaultContentSettingsAlter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
+    {
+        // Set the export_dir field.
+        $form['content_export_dir'] = [
+            '#type' => 'textfield',
+            '#title' => $this->t('Content export directory'),
+            '#default_value' => \Drupal::config('migrate_default_content.settings')->get('content_export_dir'),
+            '#description' => $this->t('The directory where the exported content is stored (relative to the Source directory).'),
+        ];
+        // Ensure when the form is submitted, the migration_export_dir is saved.
+        $form['#submit'][] = 'migrate_default_content_export_form_submit';
+    }
+}
diff --git a/src/Hook/MigrateDefaultContentHooks.php b/src/Hook/MigrateDefaultContentHooks.php
new file mode 100644
index 0000000..544a8ec
--- /dev/null
+++ b/src/Hook/MigrateDefaultContentHooks.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Drupal\migrate_default_content\Hook;
+
+use Drupal\Core\Hook\Attribute\Hook;
+/**
+ * Hook implementations for migrate_default_content.
+ */
+class MigrateDefaultContentHooks
+{
+    /**
+     * @file
+     * Functions for the migrate_default_content module.
+     */
+    /**
+     * Implements hook_migration_plugins_alter().
+     *
+     * Create migrations based on data files.
+     */
+    #[Hook('migration_plugins_alter')]
+    public static function migrationPluginsAlter(&$definitions)
+    {
+        $mdc_definitions = \Drupal::service('migrate_default_content.migration_generator')->generateMigrations();
+        $definitions = array_merge($definitions, $mdc_definitions);
+    }
+}
diff --git a/src/Plugin/migrate/process/ContentIdToRevisionReference.php b/src/Plugin/migrate/process/ContentIdToRevisionReference.php
index 1fd08e2..6343a6f 100644
--- a/src/Plugin/migrate/process/ContentIdToRevisionReference.php
+++ b/src/Plugin/migrate/process/ContentIdToRevisionReference.php
@@ -38,7 +38,7 @@ class ContentIdToRevisionReference extends ProcessPluginBase implements Containe
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/src/Plugin/migrate/process/LayoutArrayToLayoutSection.php b/src/Plugin/migrate/process/LayoutArrayToLayoutSection.php
index c39cb3c..3a4f0b8 100644
--- a/src/Plugin/migrate/process/LayoutArrayToLayoutSection.php
+++ b/src/Plugin/migrate/process/LayoutArrayToLayoutSection.php
@@ -37,7 +37,7 @@ class LayoutArrayToLayoutSection extends ProcessPluginBase implements ContainerF
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
diff --git a/src/Plugin/migrate/process/PasswordHash.php b/src/Plugin/migrate/process/PasswordHash.php
index d917306..53bbb12 100644
--- a/src/Plugin/migrate/process/PasswordHash.php
+++ b/src/Plugin/migrate/process/PasswordHash.php
@@ -37,7 +37,7 @@ class PasswordHash extends ProcessPluginBase implements ContainerFactoryPluginIn
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {
     return new static(
       $configuration,
       $plugin_id,
