diff --git a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
index 07dcf47f9db7b00f8acbad8518fb966c66353090..331719c2969e0621bb27e5cec3ab4f5752c5bce4 100644
--- a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
+++ b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
@@ -49,7 +49,7 @@ class DefaultConfigTest extends KernelTestBase {
    *
    * @dataProvider moduleListDataProvider
    */
-  public function testModuleConfig($module) {
+  public function testModuleConfig(string $module): void {
     $this->assertExtensionConfig($module, 'module');
   }
 
@@ -171,8 +171,8 @@ public static function themeListDataProvider() {
    *   An array of module names to test, with both key and value being the name
    *   of the module.
    */
-  public function moduleListDataProvider() {
-    $modules_keyed = $this->coreModuleListDataProvider();
+  public static function moduleListDataProvider(): array {
+    $modules_keyed = self::coreModuleListDataProvider();
 
     // Add a deprecated module with config.
     $modules_keyed['deprecated_module'] = ['deprecated_module'];
diff --git a/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php b/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php
index c955289fcfc79aa09865d726dc77b3df37c00d6b..9c142ae0d4bf0866980dfe33c311a8b3b8c7d146 100644
--- a/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php
+++ b/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php
@@ -13,7 +13,7 @@ trait FileSystemModuleDiscoveryDataProviderTrait {
    * @return array
    *   An array of module names to test.
    */
-  public function coreModuleListDataProvider() {
+  public static function coreModuleListDataProvider(): array {
     $prefix = dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'modules';
     $module_dirs = array_keys(iterator_to_array(new \FilesystemIterator($prefix)));
     $module_names = array_map(function ($path) use ($prefix) {