diff --git a/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php b/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php
index 66a78c4f7cd5c9e369dd64445d2a41356e6e18a9..07a5b1bd7eb8c1dd1975640f5c061139326c311d 100644
--- a/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php
+++ b/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php
@@ -1594,7 +1594,7 @@ public function testDerivedPluginDefinitions(string $yaml, ?string $expected_mes
    * @return \Generator
    *   Test scenarios.
    */
-  public function providerTestDerivedPluginDefinitions(): \Generator {
+  public static function providerTestDerivedPluginDefinitions(): \Generator {
     // Defaults inherited from CKEditor5AspectsOfCKEditor5Plugin.
     $ckeditor5_aspects_defaults = get_class_vars(CKEditor5AspectsOfCKEditor5Plugin::class);
     // Defaults inherited from DrupalAspectsOfCKEditor5Plugin.
diff --git a/core/modules/layout_builder/tests/src/Unit/SectionTest.php b/core/modules/layout_builder/tests/src/Unit/SectionTest.php
index 6ffa19570bdb85b8ad57e9a79edbfe072e9b5392..c4813f26f0420e9769ea71dbd666c5d6722e37dd 100644
--- a/core/modules/layout_builder/tests/src/Unit/SectionTest.php
+++ b/core/modules/layout_builder/tests/src/Unit/SectionTest.php
@@ -231,7 +231,7 @@ public static function providerTestGetThirdPartySettings() {
    * @covers ::getThirdPartySetting
    * @dataProvider providerTestGetThirdPartySetting
    */
-  public function testGetThirdPartySetting($provider, $key, $expected, $default = FALSE) {
+  public function testGetThirdPartySetting(string $provider, string $key, ?string $expected, mixed $default = FALSE): void {
     if ($default) {
       $this->assertSame($expected, $this->section->getThirdPartySetting($provider, $key, $default));
     }
@@ -243,7 +243,7 @@ public function testGetThirdPartySetting($provider, $key, $expected, $default =
   /**
    * Provides test data for ::testGetThirdPartySetting().
    */
-  public function providerTestGetThirdPartySetting() {
+  public static function providerTestGetThirdPartySetting(): array {
     $data = [];
     $data[] = [
       'bad_judgement',
diff --git a/core/modules/media/tests/src/Functional/MediaTypeCreationTest.php b/core/modules/media/tests/src/Functional/MediaTypeCreationTest.php
index c9162e07caefc387e6ccbc8cf16c5c8daabb66e8..ed68216a57fe24a01d1c5edf4408e52988734d20 100644
--- a/core/modules/media/tests/src/Functional/MediaTypeCreationTest.php
+++ b/core/modules/media/tests/src/Functional/MediaTypeCreationTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\Tests\media\Functional;
 
 use Drupal\media\Entity\MediaType;
+use Drupal\TestTools\Random;
 
 /**
  * Ensures that media UI works correctly without JavaScript.
@@ -49,8 +50,8 @@ public function testMediaTypeCreationForm($button_label, $address, $machine_name
   /**
    * Data provider for testMediaTypeCreationForm().
    */
-  public function providerMediaTypeCreationForm() {
-    $machine_name = $this->randomMachineName();
+  public static function providerMediaTypeCreationForm() {
+    $machine_name = Random::machineName();
     return [
       [
         'Save',
diff --git a/core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php b/core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php
index ad89fceeebf31884ec6ee8d72ef216f9964bd5f6..308d21a902fb1049f8d248cdb2ac0fc14b3102a8 100644
--- a/core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php
+++ b/core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php
@@ -109,7 +109,7 @@ public function testSubProcessSkip(string $method, array $expected_data): void {
    *
    * @return array
    */
-  public function providerTestSubProcessSkip(): array {
+  public static function providerTestSubProcessSkip(): array {
     return [
       'skip row' => [
         'method' => 'row',