diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php
index b14a8730b684fe92b557896995d97636d34f53da..f9a888c25d2724e56e35793d6c498324e049da13 100644
--- a/core/.phpstan-baseline.php
+++ b/core/.phpstan-baseline.php
@@ -30918,18 +30918,6 @@
 	'count' => 1,
 	'path' => __DIR__ . '/modules/options/src/Plugin/views/filter/ListField.php',
 ];
-$ignoreErrors[] = [
-	// identifier: missingType.return
-	'message' => '#^Function options_test_allowed_values_callback\\(\\) has no return type specified\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/modules/options/tests/options_test/options_test.module',
-];
-$ignoreErrors[] = [
-	// identifier: missingType.return
-	'message' => '#^Function options_test_dynamic_values_callback\\(\\) has no return type specified\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/modules/options/tests/options_test/options_test.module',
-];
 $ignoreErrors[] = [
 	// identifier: missingType.return
 	'message' => '#^Method Drupal\\\\Tests\\\\options\\\\FunctionalJavascript\\\\OptionsFieldUIAllowedValuesTest\\:\\:assertNodeFormOrder\\(\\) has no return type specified\\.$#',
diff --git a/core/modules/options/options.api.php b/core/modules/options/options.api.php
index 97641b1f52908e22e5a7686aabc951e7627b46b2..15367cddaba817f9e88d72d9487e4ccf616a94f4 100644
--- a/core/modules/options/options.api.php
+++ b/core/modules/options/options.api.php
@@ -77,8 +77,8 @@ function hook_options_list_alter(array &$options, array $context) {
  *
  * @ingroup callbacks
  * @see options_allowed_values()
- * @see options_test_allowed_values_callback()
- * @see options_test_dynamic_values_callback()
+ * @see \Drupal\options_test\OptionsAllowedValues::simpleValues()
+ * @see \Drupal\options_test\OptionsAllowedValues::dynamicValues()
  */
 function callback_allowed_values_function(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL, &$cacheable = TRUE) {
   if (isset($entity) && ($entity->bundle() == 'not_a_programmer')) {
diff --git a/core/modules/options/options.module b/core/modules/options/options.module
index 7c648a5c8e4c6c162570e161fef871539a688a5b..e7cd0e7fe6164f3b5ce5689b80b11dd1bd63eefb 100644
--- a/core/modules/options/options.module
+++ b/core/modules/options/options.module
@@ -41,7 +41,7 @@ function options_allowed_values(FieldStorageDefinitionInterface $definition, ?Fi
   if (!isset($allowed_values[$cache_id])) {
     $function = $definition->getSetting('allowed_values_function');
     // If $cacheable is FALSE, then the allowed values are not statically
-    // cached. See options_test_dynamic_values_callback() for an example of
+    // cached. See OptionsAllowedValues::dynamicValues() for an example of
     // generating dynamic and uncached values.
     $cacheable = TRUE;
     if (!empty($function)) {
diff --git a/core/modules/options/tests/options_test/options_test.module b/core/modules/options/tests/options_test/options_test.module
deleted file mode 100644
index 6138d62f005dea0978b85afc676c314dbd07f7fa..0000000000000000000000000000000000000000
--- a/core/modules/options/tests/options_test/options_test.module
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/**
- * @file
- * Helper module for the List module tests.
- */
-
-declare(strict_types=1);
-
-use Drupal\Core\Entity\FieldableEntityInterface;
-use Drupal\Core\Field\FieldStorageDefinitionInterface;
-
-/**
- * Implements callback_allowed_values_function().
- *
- * @see options_allowed_values()
- */
-function options_test_allowed_values_callback(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL) {
-  $values = [
-    'Group 1' => [
-      0 => 'Zero',
-    ],
-    1 => 'One',
-    'Group 2' => [
-      2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',
-    ],
-    'More <script>dangerous</script> markup' => [
-      3 => 'Three',
-    ],
-  ];
-
-  return $values;
-}
-
-/**
- * Implements callback_allowed_values_function().
- *
- * @todo This function violates the recommendation in options_allowed_values()
- *   to return a list of all possible values in any context when $items is
- *   NULL. Since this is not yet used for testing Views integration, that is
- *   alright for now. Fix this in https://www.drupal.org/node/2012130.
- *
- * @see options_allowed_values()
- */
-function options_test_dynamic_values_callback(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL, &$cacheable = NULL) {
-  $values = [];
-  if (isset($entity)) {
-    $cacheable = FALSE;
-    $values = [
-      $entity->label(),
-      $entity->toUrl()->toString(),
-      $entity->uuid(),
-      $entity->bundle(),
-    ];
-  }
-  // We need the values of the entity as keys.
-  return array_combine($values, $values);
-}
diff --git a/core/modules/options/tests/options_test/src/OptionsAllowedValues.php b/core/modules/options/tests/options_test/src/OptionsAllowedValues.php
new file mode 100644
index 0000000000000000000000000000000000000000..c3a17fd2a5ad01e883bd6cc8bff5777b8a1642fe
--- /dev/null
+++ b/core/modules/options/tests/options_test/src/OptionsAllowedValues.php
@@ -0,0 +1,60 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\options_test;
+
+use Drupal\Core\Entity\FieldableEntityInterface;
+use Drupal\Core\Field\FieldStorageDefinitionInterface;
+
+/**
+ * Provide allowed values callback.
+ */
+class OptionsAllowedValues {
+
+  /**
+   * Implements callback_allowed_values_function().
+   *
+   * @see options_allowed_values()
+   */
+  public static function simpleValues(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL): array {
+    return [
+      'Group 1' => [
+        0 => 'Zero',
+      ],
+      1 => 'One',
+      'Group 2' => [
+        2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',
+      ],
+      'More <script>dangerous</script> markup' => [
+        3 => 'Three',
+      ],
+    ];
+  }
+
+  /**
+   * Implements callback_allowed_values_function().
+   *
+   * @todo This function violates the recommendation in options_allowed_values()
+   *   to return a list of all possible values in any context when $items is
+   *   NULL. Since this is not yet used for testing Views integration, that is
+   *   alright for now. Fix this in https://www.drupal.org/node/2012130.
+   *
+   * @see options_allowed_values()
+   */
+  public static function dynamicValues(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL, &$cacheable = NULL): array {
+    $values = [];
+    if (isset($entity)) {
+      $cacheable = FALSE;
+      $values = [
+        $entity->label(),
+        $entity->toUrl()->toString(),
+        $entity->uuid(),
+        $entity->bundle(),
+      ];
+    }
+    // We need the values of the entity as keys.
+    return array_combine($values, $values);
+  }
+
+}
diff --git a/core/modules/options/tests/src/Functional/OptionsDynamicValuesTestBase.php b/core/modules/options/tests/src/Functional/OptionsDynamicValuesTestBase.php
index e74ff9aa13a749d1ea84f237a3be3cdb0073ea3b..c8d21bdd423a32b6a5000df6260e1f28d0ae1127 100644
--- a/core/modules/options/tests/src/Functional/OptionsDynamicValuesTestBase.php
+++ b/core/modules/options/tests/src/Functional/OptionsDynamicValuesTestBase.php
@@ -58,7 +58,7 @@ protected function setUp(): void {
       'type' => 'list_string',
       'cardinality' => 1,
       'settings' => [
-        'allowed_values_function' => 'options_test_dynamic_values_callback',
+        'allowed_values_function' => '\Drupal\options_test\OptionsAllowedValues::dynamicValues',
       ],
     ]);
     $this->fieldStorage->save();
@@ -77,7 +77,7 @@ protected function setUp(): void {
       ->save();
 
     // Create an entity and prepare test data that will be used by
-    // options_test_dynamic_values_callback().
+    // \Drupal\options_test\OptionsAllowedValues::dynamicValues().
     $values = [
       'user_id' => mt_rand(1, 10),
       'name' => $this->randomMachineName(),
diff --git a/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php b/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php
index c3b38e0ad943b445b9f391d477342b93ad2d35fa..99543ffe90cffa65c70af04c9231e7683aa0cbfd 100644
--- a/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php
+++ b/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php
@@ -344,7 +344,7 @@ public function testSelectListSingle(): void {
     // Test optgroups.
 
     $this->card1->setSetting('allowed_values', []);
-    $this->card1->setSetting('allowed_values_function', 'options_test_allowed_values_callback');
+    $this->card1->setSetting('allowed_values_function', '\Drupal\options_test\OptionsAllowedValues::simpleValues');
     $this->card1->save();
 
     // Display form: with no field data, nothing is selected
@@ -505,7 +505,7 @@ public function testSelectListMultiple(): void {
 
     // Use a callback function defining optgroups.
     $this->card2->setSetting('allowed_values', []);
-    $this->card2->setSetting('allowed_values_function', 'options_test_allowed_values_callback');
+    $this->card2->setSetting('allowed_values_function', '\Drupal\options_test\OptionsAllowedValues::simpleValues');
     $this->card2->save();
     $field->setRequired(FALSE);
     $field->save();
diff --git a/core/modules/options/tests/src/Kernel/OptionsDynamicValuesApiTest.php b/core/modules/options/tests/src/Kernel/OptionsDynamicValuesApiTest.php
index 483381e719da9c936a0749f19771e9a6f1557fa7..f0d94b6e7193b2e3a3e57ae92122c62d5064801c 100644
--- a/core/modules/options/tests/src/Kernel/OptionsDynamicValuesApiTest.php
+++ b/core/modules/options/tests/src/Kernel/OptionsDynamicValuesApiTest.php
@@ -46,7 +46,7 @@ protected function setUp(): void {
       'type' => 'list_string',
       'cardinality' => 1,
       'settings' => [
-        'allowed_values_function' => 'options_test_dynamic_values_callback',
+        'allowed_values_function' => '\Drupal\options_test\OptionsAllowedValues::dynamicValues',
       ],
     ]);
     $this->fieldStorage->save();
@@ -65,7 +65,7 @@ protected function setUp(): void {
       ->save();
 
     // Create an entity and prepare test data that will be used by
-    // options_test_dynamic_values_callback().
+    // \Drupal\options_test\OptionsAllowedValues::dynamicValues().
     $values = [
       'user_id' => 2,
       'name' => $this->randomMachineName(),
@@ -77,7 +77,7 @@ protected function setUp(): void {
   /**
    * Tests options_allowed_values().
    *
-   * @see options_test_dynamic_values_callback()
+   * @see \Drupal\options_test\OptionsAllowedValues::dynamicValues()
    */
   public function testOptionsAllowedValues(): void {
     // Test allowed values without passed $items.
diff --git a/core/modules/options/tests/src/Kernel/OptionsDynamicValuesValidationTest.php b/core/modules/options/tests/src/Kernel/OptionsDynamicValuesValidationTest.php
index 4922ed1193d057162a984de555fb804403c6d7ef..77b2003796c92605d14aa65f2f2538870b7b794a 100644
--- a/core/modules/options/tests/src/Kernel/OptionsDynamicValuesValidationTest.php
+++ b/core/modules/options/tests/src/Kernel/OptionsDynamicValuesValidationTest.php
@@ -51,7 +51,7 @@ protected function setUp(): void {
       'type' => 'list_string',
       'cardinality' => 1,
       'settings' => [
-        'allowed_values_function' => 'options_test_dynamic_values_callback',
+        'allowed_values_function' => '\Drupal\options_test\OptionsAllowedValues::dynamicValues',
       ],
     ])->save();
 
@@ -69,7 +69,7 @@ protected function setUp(): void {
       ->save();
 
     // Create an entity and prepare test data that will be used by
-    // options_test_dynamic_values_callback().
+    // \Drupal\options_test\OptionsAllowedValues::dynamicValues().
     $values = [
       'user_id' => 2,
       'name' => $this->randomMachineName(),
diff --git a/core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php b/core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php
index f1eb578fe33d65c4a12e810351bea522e8a14412..20dcb7a4f8efb1f3bb687f715740835c96c3a3ee 100644
--- a/core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php
+++ b/core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php
@@ -50,7 +50,7 @@ protected function setUp($import_test_views = TRUE): void {
       'type' => 'list_string',
       'cardinality' => 1,
       'settings' => [
-        'allowed_values_function' => 'options_test_dynamic_values_callback',
+        'allowed_values_function' => '\Drupal\options_test\OptionsAllowedValues::dynamicValues',
       ],
     ]);
     $this->fieldStorage->save();