From cfd85173534de72b0edfccc00ddb9ca3b711bd4b Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Tue, 14 Dec 2021 12:05:17 +0000
Subject: [PATCH] Issue #3182103 by TR, dan2k3k4, longwave, mondrake,
 Sweetchuck, Kristen Pol: Ensure correct signature for setUp(), tearDown(),
 setUpBeforeClass(), and assertPostConditions() methods

---
 .../src/Functional/AggregatorTestBase.php     |  2 +-
 .../BigPipeRegressionTest.php                 |  2 +-
 .../tests/src/Functional/BlockTestBase.php    |  2 +-
 .../src/Functional/BlockContentTestBase.php   |  2 +-
 .../Views/BlockContentFieldFilterTest.php     |  2 +-
 .../Functional/Views/BlockContentTestBase.php |  2 +-
 .../src/Kernel/BlockContentDeletionTest.php   |  2 +-
 .../src/Kernel/BlockContentDeriverTest.php    |  2 +-
 ...ockContentEntityReferenceSelectionTest.php |  2 +-
 .../Plugin/CKEditorPlugin/LanguageTest.php    |  2 +-
 .../tests/src/Functional/CommentTestBase.php  |  2 +-
 .../src/Functional/Views/CommentTestBase.php  |  2 +-
 .../Views/CommentViewsKernelTestBase.php      |  2 +-
 .../ModeratedContentLocalTaskTest.php         |  2 +-
 .../Functional/ModeratedContentViewTest.php   |  2 +-
 .../src/Functional/ModerationActionsTest.php  |  2 +-
 .../ModerationRevisionRevertTest.php          |  2 +-
 .../Functional/ModerationStateTestBase.php    |  2 +-
 ...tentTranslationPendingRevisionTestBase.php |  2 +-
 .../Functional/ContentTranslationTestBase.php |  2 +-
 .../tests/src/Functional/DateTestBase.php     |  2 +-
 .../EntityTest/EntityTestDateonlyTest.php     |  2 +-
 .../EntityTest/EntityTestDatetimeTest.php     |  2 +-
 .../Kernel/Views/DateTimeHandlerTestBase.php  |  2 +-
 .../EntityTest/EntityTestDateRangeTest.php    |  2 +-
 .../src/Functional/DbLogResourceTest.php      |  2 +-
 .../tests/src/Kernel/DbLogControllerTest.php  |  2 +-
 .../src/Functional/Views/FieldTestBase.php    |  2 +-
 .../field/tests/src/Kernel/FieldCrudTest.php  |  2 +-
 .../tests/src/Kernel/FieldKernelTestBase.php  |  2 +-
 ...grateFieldInstanceLabelDescriptionTest.php |  2 +-
 ...grateFieldInstanceLabelDescriptionTest.php |  2 +-
 .../src/Functional/FileFieldTestBase.php      |  2 +-
 .../src/Functional/FileManagedTestBase.php    |  2 +-
 .../Formatter/FileMediaFormatterTestBase.php  |  2 +-
 .../src/Kernel/FileManagedUnitTestBase.php    |  2 +-
 .../tests/src/Kernel/NormalizerTestBase.php   |  2 +-
 .../HelpTopicTranslatedTestBase.php           |  2 +-
 .../src/Functional/ImageFieldTestBase.php     |  2 +-
 .../ImageFieldTestBase.php                    |  2 +-
 .../Functional/ExternalNormalizersTest.php    |  2 +-
 .../tests/src/Functional/FileUploadTest.php   |  2 +-
 .../src/Functional/InternalEntitiesTest.php   |  2 +-
 .../Functional/JsonApiFunctionalTestBase.php  |  2 +-
 .../tests/src/Functional/ResourceTestBase.php |  2 +-
 .../src/Functional/RestJsonApiUnsupported.php |  2 +-
 .../JsonApiDocumentTopLevelNormalizerTest.php |  2 +-
 .../tests/src/Kernel/Query/FilterTest.php     |  2 +-
 .../ResourceResponseValidatorTest.php         |  2 +-
 .../JsonApiDocumentTopLevelNormalizerTest.php |  2 +-
 .../ResourceIdentifierNormalizerTest.php      |  2 +-
 .../tests/src/Kernel/LanguageTestBase.php     |  2 +-
 .../src/Kernel/Views/LanguageTestBase.php     |  2 +-
 .../Functional/Rest/LayoutRestTestBase.php    |  2 +-
 .../Functional/Rest/OverrideSectionsTest.php  |  2 +-
 .../InlineBlockTestBase.php                   |  2 +-
 .../LayoutBuilderCompatibilityTestBase.php    |  2 +-
 .../tests/src/Functional/LocaleUpdateBase.php |  2 +-
 .../Functional/MediaFunctionalTestTrait.php   |  2 +-
 .../Functional/Rest/MediaResourceTestBase.php |  2 +-
 .../MediaSourceTestBase.php                   |  2 +-
 .../src/Kernel/MediaEmbedFilterTestBase.php   |  2 +-
 .../tests/src/Kernel/MediaKernelTestBase.php  |  2 +-
 .../Plugin/migrate/process/LinkUriTest.php    |  2 +-
 .../src/Kernel/MigrateExecutableTest.php      |  2 +-
 .../Kernel/MigrateExternalTranslatedTest.php  |  2 +-
 .../tests/src/Kernel/MigrateLookupTest.php    |  2 +-
 .../src/Kernel/MigrateSourceTestBase.php      |  2 +-
 .../tests/src/Kernel/MigrateTestBase.php      |  4 +--
 .../src/Kernel/MigrationPluginManagerTest.php |  2 +-
 .../tests/src/Kernel/Plugin/LogTest.php       |  2 +-
 .../src/Kernel/Plugin/id_map/SqlTest.php      |  2 +-
 .../src/Unit/MigrationPluginManagerTest.php   |  2 +-
 .../migrate/destination/EntityTestBase.php    |  2 +-
 .../Unit/process/MigrateProcessTestCase.php   |  2 +-
 .../Unit/process/MigrationLookupTestCase.php  |  2 +-
 .../src/Kernel/IdMapTableNoDummyTest.php      |  2 +-
 .../src/Kernel/MigrateDrupalTestBase.php      |  2 +-
 .../Kernel/MigrateFieldPluginManagerTest.php  |  2 +-
 .../src/Kernel/d6/FieldDiscoveryTest.php      |  2 +-
 .../src/Kernel/d6/MigrateDrupal6TestBase.php  |  2 +-
 .../src/Kernel/d6/MigrationProcessTest.php    |  2 +-
 ...riableTranslationCheckRequirementsTest.php |  2 +-
 .../src/Kernel/d7/FieldDiscoveryTest.php      |  2 +-
 .../src/Kernel/d7/MigrateDrupal7TestBase.php  |  2 +-
 .../src/Kernel/d7/MigrationProcessTest.php    |  2 +-
 .../tests/src/Unit/FieldDiscoveryTest.php     |  2 +-
 .../src/Unit/source/DrupalSqlBaseTest.php     |  2 +-
 .../MigrateUpgradeExecuteTestBase.php         |  2 +-
 .../src/Functional/MigrateUpgradeTestBase.php |  4 +--
 .../tests/src/Functional/NodeTestBase.php     |  2 +-
 .../src/Functional/Views/NodeTestBase.php     |  2 +-
 .../NodePreviewLinkTest.php                   |  2 +-
 .../TestSettingSummariesContentType.php       |  2 +-
 .../Migrate/d6/MigrateNodeDeriverTest.php     |  2 +-
 .../Kernel/Migrate/d6/MigrateNodeTestBase.php |  2 +-
 .../tests/src/Kernel/NodeAccessTestBase.php   |  2 +-
 .../OptionsDynamicValuesTestBase.php          |  2 +-
 .../src/Kernel/OptionsFieldUnitTestBase.php   |  2 +-
 .../src/Kernel/Views/OptionsTestBase.php      |  2 +-
 .../tests/src/Functional/PathTestBase.php     |  2 +-
 .../Migrate/d7/MigrateUrlAliasTestBase.php    |  2 +-
 .../tests/src/Kernel/QuickEditTestBase.php    |  2 +-
 .../d7/MigrateResponsiveImageStylesTest.php   |  2 +-
 .../EntityResource/EntityResourceTestBase.php |  2 +-
 .../Functional/FileUploadResourceTestBase.php |  2 +-
 .../tests/src/Functional/ResourceTestBase.php |  2 +-
 .../Functional/Views/RestExportAuthTest.php   |  2 +-
 .../tests/src/Kernel/RequestHandlerTest.php   |  2 +-
 .../tests/src/Kernel/NormalizerTestBase.php   |  2 +-
 .../tests/src/Functional/ShortcutTestBase.php |  2 +-
 .../src/Functional/StatisticsTestBase.php     |  2 +-
 .../Cache/PageCacheTagsTestBase.php           |  2 +-
 .../Functional/Database/DatabaseTestBase.php  |  2 +-
 .../Entity/EntityCacheTagsTestBase.php        |  2 +-
 .../src/Functional/Module/ModuleTestBase.php  |  2 +-
 .../Module/PrepareUninstallTest.php           |  2 +-
 .../tests/src/Kernel/Render/ClassyTest.php    |  2 +-
 .../Token/TokenReplaceKernelTestBase.php      |  2 +-
 .../tests/src/Functional/TaxonomyTestBase.php |  2 +-
 .../Views/TaxonomyFieldFilterTest.php         |  2 +-
 .../src/Functional/Views/TaxonomyTestBase.php |  2 +-
 .../VocabularySerializationTest.php           |  2 +-
 .../src/Kernel/Views/TaxonomyTestBase.php     |  2 +-
 .../tests/src/Functional/TourTestBasic.php    |  2 +-
 .../TourJavascriptTest.php                    |  2 +-
 .../FunctionalJavascript/TourLegacyTest.php   |  2 +-
 .../src/Functional/UpdateUploaderTestBase.php |  2 +-
 .../src/Functional/RestRegisterUserTest.php   |  2 +-
 .../src/Functional/Views/AccessTestBase.php   |  2 +-
 .../src/Functional/Views/UserTestBase.php     |  2 +-
 .../d6/ProfileFieldCheckRequirementsTest.php  |  2 +-
 .../d7/ProfileFieldCheckRequirementsTest.php  |  2 +-
 .../src/Kernel/Views/UserKernelTestBase.php   |  2 +-
 .../Unit/Plugin/Action/RoleUserTestBase.php   |  2 +-
 .../Functional/Plugin/MonthDatePluginTest.php |  2 +-
 .../src/Functional/Plugin/ViewsBulkTest.php   |  2 +-
 .../tests/src/Functional/ViewTestBase.php     |  2 +-
 .../src/Functional/ViewTranslationTest.php    |  2 +-
 .../src/Functional/Wizard/WizardTestBase.php  |  2 +-
 .../BlockExposedFilterAJAXTest.php            |  2 +-
 .../Handler/FieldFieldAccessTestBase.php      |  2 +-
 .../tests/src/Kernel/ViewsKernelTestBase.php  |  2 +-
 .../Plugin/views/query/MysqlDateSqlTest.php   |  2 +-
 .../views/query/PostgresqlDateSqlTest.php     |  2 +-
 .../Plugin/views/query/SqliteDateSqlTest.php  |  2 +-
 .../tests/src/Functional/UITestBase.php       |  2 +-
 .../src/FunctionalJavascript/DisplayTest.php  |  2 +-
 .../FilterCriteriaTest.php                    |  2 +-
 .../FilterOptionsTest.php                     |  2 +-
 .../src/FunctionalJavascript/PreviewTest.php  |  2 +-
 .../tests/src/Functional/WorkspaceTest.php    |  2 +-
 .../BuildTests/Framework/BuildTestBase.php    |  6 ++--
 .../Ajax/ThrobberTest.php                     |  2 +-
 .../WebDriverTestBase.php                     |  2 +-
 .../FunctionalTests/Image/ToolkitTestBase.php |  2 +-
 .../Installer/InstallerTestBase.php           |  2 +-
 .../Update/UpdatePathTestBase.php             |  2 +-
 .../Cache/GenericCacheBackendUnitTestBase.php |  4 +--
 .../Core/Database/DatabaseTestBase.php        |  2 +-
 .../Entity/EntityAccessControlHandlerTest.php |  2 +-
 .../Core/Entity/EntityKernelTestBase.php      |  2 +-
 .../Core/Entity/EntityLanguageTestBase.php    |  2 +-
 .../Core/Entity/EntityRepositoryTest.php      |  2 +-
 .../KernelTests/Core/File/FileTestBase.php    |  2 +-
 .../Core/File/StreamWrapperTest.php           |  2 +-
 .../Core/KeyValueStore/StorageTestBase.php    |  2 +-
 .../Context/ContextAwarePluginBaseTest.php    |  2 +-
 .../Context/ContextAwarePluginTraitTest.php   |  2 +-
 .../Core/Plugin/PluginTestBase.php            |  2 +-
 .../RecursiveContextualValidatorTest.php      |  2 +-
 .../Drupal/KernelTests/KernelTestBase.php     |  8 ++---
 .../PhpUnit8/ClassWriter.php                  |  5 ----
 core/tests/Drupal/Tests/BrowserTestBase.php   |  6 ++--
 .../Annotation/Doctrine/Ticket/DCOM58Test.php |  2 +-
 .../MTimeProtectedFileStorageBase.php         |  2 +-
 .../PhpStorage/PhpStorageTestBase.php         |  2 +-
 .../Component/Serialization/YamlTest.php      |  4 +--
 .../Composer/Plugin/Scaffold/Fixtures.php     |  2 +-
 .../VendorHardeningPluginTest.php             |  2 +-
 .../Core/Assert/AssertLegacyTraitTest.php     |  2 +-
 .../Core/Assert/WebAssertArgumentsTest.php    |  2 +-
 .../Cache/Context/SessionCacheContextTest.php |  2 +-
 .../Tests/Core/Command/GenerateThemeTest.php  |  2 +-
 .../Tests/Core/Command/QuickStartTest.php     |  4 +--
 .../Database/Driver/mysql/ConnectionTest.php  |  2 +-
 .../Driver/mysql/install/TasksTest.php        |  2 +-
 .../Field/BaseFieldDefinitionTestBase.php     |  2 +-
 .../Core/Form/FormStateDecoratorBaseTest.php  |  2 +-
 .../Drupal/Tests/Core/Form/FormTestBase.php   |  4 +--
 .../Menu/LocalTaskIntegrationTestBase.php     |  2 +-
 .../Plugin/LazyPluginCollectionTestBase.php   |  2 +-
 .../Tests/Core/Render/RendererTestBase.php    |  2 +-
 .../Core/Routing/LazyRouteCollectionTest.php  |  2 +-
 .../Tests/Core/Template/TwigExtensionTest.php |  2 +-
 .../Core/Theme/AjaxBasePageNegotiatorTest.php |  2 +-
 .../Drupal/Tests/Listeners/DrupalListener.php | 30 +------------------
 core/tests/Drupal/Tests/UnitTestCase.php      |  4 +--
 198 files changed, 211 insertions(+), 244 deletions(-)

diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php
index 3e5ce2503265..31ccc25bba6f 100644
--- a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php
+++ b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php
@@ -38,7 +38,7 @@ abstract class AggregatorTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create an Article node type.
diff --git a/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php b/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php
index 58cb7048881e..70a5bc02145c 100644
--- a/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php
+++ b/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php
@@ -42,7 +42,7 @@ class BigPipeRegressionTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     // Use the big_pipe_test_theme theme.
diff --git a/core/modules/block/tests/src/Functional/BlockTestBase.php b/core/modules/block/tests/src/Functional/BlockTestBase.php
index 83b7de0060a5..04b7c91e2a29 100644
--- a/core/modules/block/tests/src/Functional/BlockTestBase.php
+++ b/core/modules/block/tests/src/Functional/BlockTestBase.php
@@ -40,7 +40,7 @@ abstract class BlockTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Use the test page as the front page.
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTestBase.php b/core/modules/block_content/tests/src/Functional/BlockContentTestBase.php
index 43220d1e73c6..baf521f862b7 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentTestBase.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentTestBase.php
@@ -51,7 +51,7 @@ abstract class BlockContentTestBase extends BrowserTestBase {
   /**
    * Sets the test up.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     if ($this->autoCreateBasicBlockType) {
       $this->createBlockContentType('basic', TRUE);
diff --git a/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php b/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php
index 60249e60e47f..2946c9cadb97 100644
--- a/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php
+++ b/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php
@@ -39,7 +39,7 @@ class BlockContentFieldFilterTest extends BlockContentTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp($import_test_views = TRUE): void {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     // Add two new languages.
diff --git a/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php b/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php
index 766e43fb780c..04b270f7a9d1 100644
--- a/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php
+++ b/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php
@@ -40,7 +40,7 @@ abstract class BlockContentTestBase extends ViewTestBase {
     'block_content_test_views',
   ];
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
     // Ensure the basic bundle exists. This is provided by the standard profile.
     $this->createBlockContentType(['id' => 'basic']);
diff --git a/core/modules/block_content/tests/src/Kernel/BlockContentDeletionTest.php b/core/modules/block_content/tests/src/Kernel/BlockContentDeletionTest.php
index 14833adff607..c8e5a5706b64 100644
--- a/core/modules/block_content/tests/src/Kernel/BlockContentDeletionTest.php
+++ b/core/modules/block_content/tests/src/Kernel/BlockContentDeletionTest.php
@@ -22,7 +22,7 @@ class BlockContentDeletionTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('block_content');
diff --git a/core/modules/block_content/tests/src/Kernel/BlockContentDeriverTest.php b/core/modules/block_content/tests/src/Kernel/BlockContentDeriverTest.php
index 640bbb1eda05..3695c591b634 100644
--- a/core/modules/block_content/tests/src/Kernel/BlockContentDeriverTest.php
+++ b/core/modules/block_content/tests/src/Kernel/BlockContentDeriverTest.php
@@ -22,7 +22,7 @@ class BlockContentDeriverTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('block_content');
diff --git a/core/modules/block_content/tests/src/Kernel/BlockContentEntityReferenceSelectionTest.php b/core/modules/block_content/tests/src/Kernel/BlockContentEntityReferenceSelectionTest.php
index 738a809355ec..53d9562cec56 100644
--- a/core/modules/block_content/tests/src/Kernel/BlockContentEntityReferenceSelectionTest.php
+++ b/core/modules/block_content/tests/src/Kernel/BlockContentEntityReferenceSelectionTest.php
@@ -65,7 +65,7 @@ class BlockContentEntityReferenceSelectionTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->installSchema('system', ['sequences']);
     $this->installEntitySchema('user');
diff --git a/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php b/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php
index 1c6b56bb12fb..76e296197e84 100644
--- a/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php
+++ b/core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php
@@ -23,7 +23,7 @@ class LanguageTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     $this->plugin = new Language([], $this->randomMachineName(), []);
   }
 
diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php
index 9b44b420959c..138021e87666 100644
--- a/core/modules/comment/tests/src/Functional/CommentTestBase.php
+++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php
@@ -54,7 +54,7 @@ abstract class CommentTestBase extends BrowserTestBase {
    */
   protected $node;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create an article content type only if it does not yet exist, so that
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php b/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php
index eda163549779..9cf1873c87d3 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php
@@ -56,7 +56,7 @@ abstract class CommentTestBase extends ViewTestBase {
    */
   protected $comment;
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     ViewTestData::createTestViews(static::class, ['comment_test_views']);
diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentViewsKernelTestBase.php b/core/modules/comment/tests/src/Kernel/Views/CommentViewsKernelTestBase.php
index ec274bbe1914..b10828a90a1f 100644
--- a/core/modules/comment/tests/src/Kernel/Views/CommentViewsKernelTestBase.php
+++ b/core/modules/comment/tests/src/Kernel/Views/CommentViewsKernelTestBase.php
@@ -39,7 +39,7 @@ abstract class CommentViewsKernelTestBase extends ViewsKernelTestBase {
    */
   protected $userStorage;
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     ViewTestData::createTestViews(static::class, ['comment_test_views']);
diff --git a/core/modules/content_moderation/tests/src/Functional/ModeratedContentLocalTaskTest.php b/core/modules/content_moderation/tests/src/Functional/ModeratedContentLocalTaskTest.php
index 6797bca5f014..64cc55f1b02e 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModeratedContentLocalTaskTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModeratedContentLocalTaskTest.php
@@ -35,7 +35,7 @@ class ModeratedContentLocalTaskTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->drupalPlaceBlock('local_tasks_block');
diff --git a/core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php b/core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php
index 218e1c3c01c2..cf01a082a097 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php
@@ -42,7 +42,7 @@ class ModeratedContentViewTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page'])->save();
diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationActionsTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationActionsTest.php
index 5d3a98965be4..e395a0ac5b1a 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModerationActionsTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModerationActionsTest.php
@@ -36,7 +36,7 @@ class ModerationActionsTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $moderated_bundle = $this->createContentType(['type' => 'moderated_bundle']);
diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationRevisionRevertTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationRevisionRevertTest.php
index 069fe7891500..71a6925a43c7 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModerationRevisionRevertTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModerationRevisionRevertTest.php
@@ -34,7 +34,7 @@ class ModerationRevisionRevertTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $moderated_bundle = $this->createContentType(['type' => 'moderated_bundle']);
diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php
index 7e254eadfacc..350c8d0d87a7 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php
@@ -72,7 +72,7 @@ abstract class ModerationStateTestBase extends BrowserTestBase {
   /**
    * Sets the test up.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->workflow = $this->createEditorialWorkflow();
     $this->adminUser = $this->drupalCreateUser($this->permissions);
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php
index dbf00f2c3477..947e4ed6dc46 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php
@@ -48,7 +48,7 @@ abstract class ContentTranslationPendingRevisionTestBase extends ContentTranslat
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     $this->entityTypeId = 'node';
     $this->bundle = 'article';
 
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php
index 17d40b7a8bac..a14cd5902b90 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php
@@ -82,7 +82,7 @@ abstract class ContentTranslationTestBase extends BrowserTestBase {
    */
   protected $manager;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->setupLanguages();
diff --git a/core/modules/datetime/tests/src/Functional/DateTestBase.php b/core/modules/datetime/tests/src/Functional/DateTestBase.php
index 4fce222082a9..2581b0eec5a3 100644
--- a/core/modules/datetime/tests/src/Functional/DateTestBase.php
+++ b/core/modules/datetime/tests/src/Functional/DateTestBase.php
@@ -88,7 +88,7 @@ abstract protected function getTestFieldType();
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $web_user = $this->drupalCreateUser([
diff --git a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php
index 04e38fd0163e..cf1c247f3917 100644
--- a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php
+++ b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php
@@ -47,7 +47,7 @@ class EntityTestDateonlyTest extends EntityTestResourceTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     // Add datetime field.
diff --git a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php
index 2030900cf421..34474958af81 100644
--- a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php
+++ b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php
@@ -47,7 +47,7 @@ class EntityTestDatetimeTest extends EntityTestResourceTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     // Add datetime field.
diff --git a/core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php b/core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php
index 4c48cd3f6fc7..0cb21d7b2b9b 100644
--- a/core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php
+++ b/core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php
@@ -47,7 +47,7 @@ abstract class DateTimeHandlerTestBase extends ViewsKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     $this->installSchema('node', 'node_access');
diff --git a/core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php b/core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php
index 636221f95117..9e5ee8264cce 100644
--- a/core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php
+++ b/core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php
@@ -47,7 +47,7 @@ class EntityTestDateRangeTest extends EntityTestResourceTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     // Add datetime_range field.
diff --git a/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php b/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
index 4294949ef995..38c1af1f3a00 100644
--- a/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
+++ b/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
@@ -50,7 +50,7 @@ class DbLogResourceTest extends ResourceTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $auth = isset(static::$auth) ? [static::$auth] : [];
diff --git a/core/modules/dblog/tests/src/Kernel/DbLogControllerTest.php b/core/modules/dblog/tests/src/Kernel/DbLogControllerTest.php
index 2aac3efe53c1..60768f1fa62c 100644
--- a/core/modules/dblog/tests/src/Kernel/DbLogControllerTest.php
+++ b/core/modules/dblog/tests/src/Kernel/DbLogControllerTest.php
@@ -17,7 +17,7 @@ class DbLogControllerTest extends KernelTestBase {
    */
   protected static $modules = ['dblog', 'user'];
 
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installSchema('dblog', ['watchdog']);
diff --git a/core/modules/field/tests/src/Functional/Views/FieldTestBase.php b/core/modules/field/tests/src/Functional/Views/FieldTestBase.php
index 7a47b4140f71..5bda2f24da83 100644
--- a/core/modules/field/tests/src/Functional/Views/FieldTestBase.php
+++ b/core/modules/field/tests/src/Functional/Views/FieldTestBase.php
@@ -42,7 +42,7 @@ abstract class FieldTestBase extends ViewTestBase {
    */
   public $fields;
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     // Ensure the page node type exists.
diff --git a/core/modules/field/tests/src/Kernel/FieldCrudTest.php b/core/modules/field/tests/src/Kernel/FieldCrudTest.php
index 15ef3afe92fb..24ee72628220 100644
--- a/core/modules/field/tests/src/Kernel/FieldCrudTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldCrudTest.php
@@ -38,7 +38,7 @@ class FieldCrudTest extends FieldKernelTestBase {
    */
   protected $fieldDefinition;
 
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->fieldStorageDefinition = [
diff --git a/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php b/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php
index 521c9a781a22..e9eb7839624e 100644
--- a/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php
+++ b/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php
@@ -47,7 +47,7 @@ abstract class FieldKernelTestBase extends KernelTestBase {
   /**
    * Set the default field storage backend for fields created during tests.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->fieldTestData = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
diff --git a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceLabelDescriptionTest.php b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceLabelDescriptionTest.php
index 940f91d72db1..95ff3db1edd3 100644
--- a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceLabelDescriptionTest.php
+++ b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceLabelDescriptionTest.php
@@ -29,7 +29,7 @@ class MigrateFieldInstanceLabelDescriptionTest extends MigrateDrupal6TestBase im
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->migrateFields();
 
diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceLabelDescriptionTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceLabelDescriptionTest.php
index 161f6cd94651..a777d25b3c11 100644
--- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceLabelDescriptionTest.php
+++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceLabelDescriptionTest.php
@@ -39,7 +39,7 @@ class MigrateFieldInstanceLabelDescriptionTest extends MigrateDrupal7TestBase im
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installEntitySchema('node');
diff --git a/core/modules/file/tests/src/Functional/FileFieldTestBase.php b/core/modules/file/tests/src/Functional/FileFieldTestBase.php
index cbfe67fa3c18..2fa0f534a422 100644
--- a/core/modules/file/tests/src/Functional/FileFieldTestBase.php
+++ b/core/modules/file/tests/src/Functional/FileFieldTestBase.php
@@ -35,7 +35,7 @@ abstract class FileFieldTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->adminUser = $this->drupalCreateUser([
       'access content',
diff --git a/core/modules/file/tests/src/Functional/FileManagedTestBase.php b/core/modules/file/tests/src/Functional/FileManagedTestBase.php
index f9b14434c565..17f0e1a91a97 100644
--- a/core/modules/file/tests/src/Functional/FileManagedTestBase.php
+++ b/core/modules/file/tests/src/Functional/FileManagedTestBase.php
@@ -20,7 +20,7 @@ abstract class FileManagedTestBase extends BrowserTestBase {
    */
   protected static $modules = ['file_test', 'file'];
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // Clear out any hook calls.
     file_test_reset();
diff --git a/core/modules/file/tests/src/Functional/Formatter/FileMediaFormatterTestBase.php b/core/modules/file/tests/src/Functional/Formatter/FileMediaFormatterTestBase.php
index aca03382dabc..df630fad2a1f 100644
--- a/core/modules/file/tests/src/Functional/Formatter/FileMediaFormatterTestBase.php
+++ b/core/modules/file/tests/src/Functional/Formatter/FileMediaFormatterTestBase.php
@@ -26,7 +26,7 @@ abstract class FileMediaFormatterTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->drupalLogin($this->drupalCreateUser(['view test entity']));
   }
diff --git a/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php b/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php
index 53012f3d9c7e..5b148a06dd06 100644
--- a/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php
+++ b/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php
@@ -21,7 +21,7 @@ abstract class FileManagedUnitTestBase extends KernelTestBase {
    */
   protected static $modules = ['file_test', 'file', 'system', 'field', 'user'];
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // Clear out any hook calls.
     file_test_reset();
diff --git a/core/modules/hal/tests/src/Kernel/NormalizerTestBase.php b/core/modules/hal/tests/src/Kernel/NormalizerTestBase.php
index f61890e6de17..9f2e4fb841c6 100644
--- a/core/modules/hal/tests/src/Kernel/NormalizerTestBase.php
+++ b/core/modules/hal/tests/src/Kernel/NormalizerTestBase.php
@@ -53,7 +53,7 @@ abstract class NormalizerTestBase extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
diff --git a/core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php b/core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
index c2f1158aa543..8ddc65373ab4 100644
--- a/core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
+++ b/core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
@@ -25,7 +25,7 @@ abstract class HelpTopicTranslatedTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // These tests rely on some markup from the 'Seven' theme.
diff --git a/core/modules/image/tests/src/Functional/ImageFieldTestBase.php b/core/modules/image/tests/src/Functional/ImageFieldTestBase.php
index 82cef6e7757c..f56106519143 100644
--- a/core/modules/image/tests/src/Functional/ImageFieldTestBase.php
+++ b/core/modules/image/tests/src/Functional/ImageFieldTestBase.php
@@ -45,7 +45,7 @@ abstract class ImageFieldTestBase extends BrowserTestBase {
    */
   protected $adminUser;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create Basic page and Article node types.
diff --git a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php
index faf352ed1675..3e8bf2450183 100644
--- a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php
+++ b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldTestBase.php
@@ -38,7 +38,7 @@ abstract class ImageFieldTestBase extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create Basic page and Article node types.
diff --git a/core/modules/jsonapi/tests/src/Functional/ExternalNormalizersTest.php b/core/modules/jsonapi/tests/src/Functional/ExternalNormalizersTest.php
index 3214ca43018b..1963cb02b9ea 100644
--- a/core/modules/jsonapi/tests/src/Functional/ExternalNormalizersTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ExternalNormalizersTest.php
@@ -59,7 +59,7 @@ class ExternalNormalizersTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     // This test is not about access control at all, so allow anonymous users to
diff --git a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
index a44424b61c40..415b717dceda 100644
--- a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
@@ -105,7 +105,7 @@ class FileUploadTest extends ResourceTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->fileStorage = $this->container->get('entity_type.manager')
diff --git a/core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php b/core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php
index 032c49698e53..5d873695442a 100644
--- a/core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php
@@ -59,7 +59,7 @@ class InternalEntitiesTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->testUser = $this->drupalCreateUser([
       'view test entity',
diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTestBase.php b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTestBase.php
index 832278be1b5b..e6f4713a653f 100644
--- a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTestBase.php
+++ b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTestBase.php
@@ -92,7 +92,7 @@ abstract class JsonApiFunctionalTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Set up a HTTP client that accepts relative URLs.
diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
index ada184a7d820..50f93b802427 100644
--- a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
+++ b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
@@ -216,7 +216,7 @@ abstract class ResourceTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->serializer = $this->container->get('jsonapi.serializer');
diff --git a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
index d58bc02b2f70..317550c40b6e 100644
--- a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
+++ b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
@@ -61,7 +61,7 @@ protected function setUpAuthorization($method) {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     // Set up a HTTP client that accepts relative URLs.
diff --git a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
index c9154a6d445f..c3ee121f41d8 100644
--- a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
+++ b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
@@ -199,7 +199,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  public function tearDown(): void {
+  protected function tearDown(): void {
     if ($this->node) {
       $this->node->delete();
     }
diff --git a/core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php b/core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php
index 10d14408721f..8474c6c6be7e 100644
--- a/core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php
+++ b/core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php
@@ -56,7 +56,7 @@ class FilterTest extends JsonapiKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->setUpSchemas();
diff --git a/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php b/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php
index e6c1c566cfaa..15c522abd180 100644
--- a/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php
+++ b/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php
@@ -33,7 +33,7 @@ class ResourceResponseValidatorTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     // Check that the validation class is available.
     if (!class_exists("\\JsonSchema\\Validator")) {
diff --git a/core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php b/core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
index 337d72675fd9..589a0d48914a 100644
--- a/core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
+++ b/core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
@@ -35,7 +35,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     $resource_type_repository = $this->prophesize(ResourceTypeRepository::class);
     $field_resolver = $this->prophesize(FieldResolver::class);
 
diff --git a/core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php b/core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php
index 70adf33c5c62..c546f6f1855e 100644
--- a/core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php
+++ b/core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php
@@ -44,7 +44,7 @@ class ResourceIdentifierNormalizerTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     $target_resource_type = new ResourceType('lorem', 'dummy_bundle', NULL);
     $relationship_fields = [
       'field_dummy' => new ResourceTypeRelationship('field_dummy'),
diff --git a/core/modules/language/tests/src/Kernel/LanguageTestBase.php b/core/modules/language/tests/src/Kernel/LanguageTestBase.php
index 458eeaec53a2..26077dfb0102 100644
--- a/core/modules/language/tests/src/Kernel/LanguageTestBase.php
+++ b/core/modules/language/tests/src/Kernel/LanguageTestBase.php
@@ -27,7 +27,7 @@ abstract class LanguageTestBase extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installConfig(['language']);
diff --git a/core/modules/language/tests/src/Kernel/Views/LanguageTestBase.php b/core/modules/language/tests/src/Kernel/Views/LanguageTestBase.php
index fc4cabf1ba82..4156fb2aa0ff 100644
--- a/core/modules/language/tests/src/Kernel/Views/LanguageTestBase.php
+++ b/core/modules/language/tests/src/Kernel/Views/LanguageTestBase.php
@@ -17,7 +17,7 @@ abstract class LanguageTestBase extends ViewsKernelTestBase {
    */
   protected static $modules = ['system', 'language'];
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp();
     $this->installConfig(['language']);
 
diff --git a/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php b/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php
index 377084483683..5c6e9786ccbe 100644
--- a/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php
+++ b/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php
@@ -43,7 +43,7 @@ abstract class LayoutRestTestBase extends ResourceTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $assert_session = $this->assertSession();
 
diff --git a/core/modules/layout_builder/tests/src/Functional/Rest/OverrideSectionsTest.php b/core/modules/layout_builder/tests/src/Functional/Rest/OverrideSectionsTest.php
index 9ea9fccec14d..9f7f75d39fa3 100644
--- a/core/modules/layout_builder/tests/src/Functional/Rest/OverrideSectionsTest.php
+++ b/core/modules/layout_builder/tests/src/Functional/Rest/OverrideSectionsTest.php
@@ -28,7 +28,7 @@ class OverrideSectionsTest extends LayoutRestTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     // @todo Figure why field definitions have to cleared in
     //   https://www.drupal.org/project/drupal/issues/2985882.
diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php
index dbf68d6179c1..293c450a9152 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php
@@ -44,7 +44,7 @@ abstract class InlineBlockTestBase extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->drupalPlaceBlock('local_tasks_block');
diff --git a/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php
index 629f530cc08a..c6967eccc288 100644
--- a/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php
+++ b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php
@@ -37,7 +37,7 @@ abstract class LayoutBuilderCompatibilityTestBase extends EntityKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installEntitySchema('entity_test_base_field_display');
diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateBase.php b/core/modules/locale/tests/src/Functional/LocaleUpdateBase.php
index e6ddd71ee341..8edaa63773f0 100644
--- a/core/modules/locale/tests/src/Functional/LocaleUpdateBase.php
+++ b/core/modules/locale/tests/src/Functional/LocaleUpdateBase.php
@@ -52,7 +52,7 @@ abstract class LocaleUpdateBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Setup timestamps to identify old and new translation sources.
diff --git a/core/modules/media/tests/src/Functional/MediaFunctionalTestTrait.php b/core/modules/media/tests/src/Functional/MediaFunctionalTestTrait.php
index 379ba7471791..702518dac35a 100644
--- a/core/modules/media/tests/src/Functional/MediaFunctionalTestTrait.php
+++ b/core/modules/media/tests/src/Functional/MediaFunctionalTestTrait.php
@@ -56,7 +56,7 @@ trait MediaFunctionalTestTrait {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Have two users ready to be used in tests.
diff --git a/core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php b/core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php
index e3889ca80202..eddbd54083c3 100644
--- a/core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php
+++ b/core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php
@@ -41,7 +41,7 @@ abstract class MediaResourceTestBase extends EntityResourceTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     \Drupal::configFactory()
diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php
index be926347c371..aadfcc54b2ad 100644
--- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php
+++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php
@@ -14,7 +14,7 @@ abstract class MediaSourceTestBase extends MediaJavascriptTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Let's set the canonical flag in the base class of the source tests,
diff --git a/core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php b/core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php
index 231356635ba8..46c327def2e6 100644
--- a/core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php
+++ b/core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php
@@ -67,7 +67,7 @@ abstract class MediaEmbedFilterTestBase extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installSchema('file', ['file_usage']);
diff --git a/core/modules/media/tests/src/Kernel/MediaKernelTestBase.php b/core/modules/media/tests/src/Kernel/MediaKernelTestBase.php
index 8996f03fa454..34219df6208f 100644
--- a/core/modules/media/tests/src/Kernel/MediaKernelTestBase.php
+++ b/core/modules/media/tests/src/Kernel/MediaKernelTestBase.php
@@ -56,7 +56,7 @@ abstract class MediaKernelTestBase extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installEntitySchema('user');
diff --git a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/process/LinkUriTest.php b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/process/LinkUriTest.php
index 0166df80c9b1..f52bd0f99061 100644
--- a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/process/LinkUriTest.php
+++ b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/process/LinkUriTest.php
@@ -31,7 +31,7 @@ class LinkUriTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->setUpCurrentUser();
     $this->installEntitySchema('node');
diff --git a/core/modules/migrate/tests/src/Kernel/MigrateExecutableTest.php b/core/modules/migrate/tests/src/Kernel/MigrateExecutableTest.php
index 65e3f13143c9..8b79c66eb45a 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrateExecutableTest.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrateExecutableTest.php
@@ -16,7 +16,7 @@ class MigrateExecutableTest extends MigrateTestBase {
     'user',
   ];
 
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
diff --git a/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php b/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php
index 5a019ec2fd15..f7e8ffae3a3b 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php
@@ -31,7 +31,7 @@ class MigrateExternalTranslatedTest extends MigrateTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->installSchema('system', ['sequences']);
     $this->installSchema('node', ['node_access']);
diff --git a/core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php b/core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php
index 4b2ec45b7d3a..4225653dda5b 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrateLookupTest.php
@@ -36,7 +36,7 @@ class MigrateLookupTest extends MigrateTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->setTestLogger();
     $this->migrateLookup = $this->container->get('migrate.lookup');
diff --git a/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php b/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
index 9efe7d0d4fef..0c351aac4bed 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
@@ -53,7 +53,7 @@ abstract public function providerSource();
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create a mock migration. This will be injected into the source plugin
diff --git a/core/modules/migrate/tests/src/Kernel/MigrateTestBase.php b/core/modules/migrate/tests/src/Kernel/MigrateTestBase.php
index b9d3f66b644a..b0481d792f8d 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrateTestBase.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrateTestBase.php
@@ -63,7 +63,7 @@ abstract class MigrateTestBase extends KernelTestBase implements MigrateMessageI
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->createMigrationConnection();
     $this->sourceDatabase = Database::getConnection('default', 'migrate');
@@ -104,7 +104,7 @@ private function createMigrationConnection() {
   /**
    * {@inheritdoc}
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     $this->cleanupMigrateConnection();
     parent::tearDown();
     $this->databaseDumpFiles = [];
diff --git a/core/modules/migrate/tests/src/Kernel/MigrationPluginManagerTest.php b/core/modules/migrate/tests/src/Kernel/MigrationPluginManagerTest.php
index 17ca386f1de5..44fe7878baba 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrationPluginManagerTest.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrationPluginManagerTest.php
@@ -26,7 +26,7 @@ class MigrationPluginManagerTest extends MigrateTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->migrationPluginManager = \Drupal::service('plugin.manager.migration');
   }
diff --git a/core/modules/migrate/tests/src/Kernel/Plugin/LogTest.php b/core/modules/migrate/tests/src/Kernel/Plugin/LogTest.php
index f03d62418702..299f7e5e135e 100644
--- a/core/modules/migrate/tests/src/Kernel/Plugin/LogTest.php
+++ b/core/modules/migrate/tests/src/Kernel/Plugin/LogTest.php
@@ -37,7 +37,7 @@ class LogTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $definition = [
       'source' => [
diff --git a/core/modules/migrate/tests/src/Kernel/Plugin/id_map/SqlTest.php b/core/modules/migrate/tests/src/Kernel/Plugin/id_map/SqlTest.php
index 42f7c4626af9..4073829f28a0 100644
--- a/core/modules/migrate/tests/src/Kernel/Plugin/id_map/SqlTest.php
+++ b/core/modules/migrate/tests/src/Kernel/Plugin/id_map/SqlTest.php
@@ -49,7 +49,7 @@ class SqlTest extends MigrateTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->database = \Drupal::database();
     $this->eventDispatcher = $this->prophesize(EventDispatcherInterface::class)
diff --git a/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
index a6ff0931ea56..49eb4bbd39d5 100644
--- a/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
@@ -22,7 +22,7 @@ class MigrationPluginManagerTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     // Get a plugin manager for testing.
diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php
index 2d2e1b4cd653..4a5ff3d8a1e2 100644
--- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php
+++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php
@@ -41,7 +41,7 @@ class EntityTestBase extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->migration = $this->prophesize(MigrationInterface::class);
diff --git a/core/modules/migrate/tests/src/Unit/process/MigrateProcessTestCase.php b/core/modules/migrate/tests/src/Unit/process/MigrateProcessTestCase.php
index cff1ee7359d0..0f50059a3ff3 100644
--- a/core/modules/migrate/tests/src/Unit/process/MigrateProcessTestCase.php
+++ b/core/modules/migrate/tests/src/Unit/process/MigrateProcessTestCase.php
@@ -24,7 +24,7 @@ abstract class MigrateProcessTestCase extends MigrateTestCase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     $this->row = $this->getMockBuilder('Drupal\migrate\Row')
       ->disableOriginalConstructor()
       ->getMock();
diff --git a/core/modules/migrate/tests/src/Unit/process/MigrationLookupTestCase.php b/core/modules/migrate/tests/src/Unit/process/MigrationLookupTestCase.php
index c22127dd9d8f..f23883aa8cec 100644
--- a/core/modules/migrate/tests/src/Unit/process/MigrationLookupTestCase.php
+++ b/core/modules/migrate/tests/src/Unit/process/MigrationLookupTestCase.php
@@ -28,7 +28,7 @@ abstract class MigrationLookupTestCase extends MigrateProcessTestCase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->migrateStub = $this->prophesize(MigrateStub::class);
     $this->migrateLookup = $this->prophesize(MigrateLookupInterface::class);
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/IdMapTableNoDummyTest.php b/core/modules/migrate_drupal/tests/src/Kernel/IdMapTableNoDummyTest.php
index 6a3ff44f031c..23a5667dbeb0 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/IdMapTableNoDummyTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/IdMapTableNoDummyTest.php
@@ -21,7 +21,7 @@ class IdMapTableNoDummyTest extends MigrateDrupal6TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->pluginManager = $this->container->get('plugin.manager.migration');
     $this->pluginManager->createInstance('d6_user');
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalTestBase.php b/core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalTestBase.php
index 803fb1fa12fc..5cb4a954237e 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalTestBase.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalTestBase.php
@@ -27,7 +27,7 @@ abstract class MigrateDrupalTestBase extends MigrateTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $module_handler = \Drupal::moduleHandler();
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php b/core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php
index 69bde8bfcac5..ebd4df5be0e6 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php
@@ -39,7 +39,7 @@ class MigrateFieldPluginManagerTest extends MigrateDrupalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->pluginManager = $this->container->get('plugin.manager.migrate.field');
   }
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php
index 7085fa7239e5..1e561bcb0f44 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php
@@ -65,7 +65,7 @@ class FieldDiscoveryTest extends MigrateDrupal6TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->installConfig(['node']);
     $this->executeMigration('d6_node_type');
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php
index ac58395aafed..3634627457c7 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php
@@ -29,7 +29,7 @@ abstract class MigrateDrupal6TestBase extends MigrateDrupalTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // Add a node classic migrate table to the destination site so that tests
     // run by default with the classic node migrations.
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrationProcessTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrationProcessTest.php
index 2e712542e4d6..cd08d217e2c5 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrationProcessTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrationProcessTest.php
@@ -16,7 +16,7 @@ class MigrationProcessTest extends MigrateDrupal6TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     self::$modules = array_keys($this->coreModuleListDataProvider());
     parent::setUp();
   }
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/VariableTranslationCheckRequirementsTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/VariableTranslationCheckRequirementsTest.php
index 03ee60ef0a75..8f5767357ca4 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d6/VariableTranslationCheckRequirementsTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/VariableTranslationCheckRequirementsTest.php
@@ -19,7 +19,7 @@ class VariableTranslationCheckRequirementsTest extends MigrateDrupal6TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->sourceDatabase->schema()->dropTable('i18n_variable');
   }
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php
index f3074924aa41..04cc3c597563 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php
@@ -70,7 +70,7 @@ class FieldDiscoveryTest extends MigrateDrupal7TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->installConfig(static::$modules);
     $node_types = [
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7TestBase.php b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7TestBase.php
index d3cc3ead9027..58ebb4aa4d97 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7TestBase.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7TestBase.php
@@ -16,7 +16,7 @@ abstract class MigrateDrupal7TestBase extends MigrateDrupalTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // Add a node classic migrate table to the destination site so that tests
     // run by default with the classic node migrations.
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrationProcessTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrationProcessTest.php
index 9d0c24ae3e04..24d8f7afe2cb 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrationProcessTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrationProcessTest.php
@@ -16,7 +16,7 @@ class MigrationProcessTest extends MigrateDrupal7TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     self::$modules = array_keys($this->coreModuleListDataProvider());
     parent::setUp();
   }
diff --git a/core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php b/core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php
index a08fd8393149..1c60da83fee0 100644
--- a/core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php
+++ b/core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php
@@ -42,7 +42,7 @@ class FieldDiscoveryTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->fieldPluginManager = $this->prophesize(MigrateFieldPluginManagerInterface::class);
     $this->migrationPluginManager = $this->prophesize(MigrationPluginManagerInterface::class);
diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
index 8792b10223bc..0be44f6ee39f 100644
--- a/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
+++ b/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
@@ -64,7 +64,7 @@ class DrupalSqlBaseTest extends MigrateTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->pluginDefinition['requirements_met'] = TRUE;
     $this->pluginDefinition['source_module'] = 'module1';
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
index 9b61a8bd7e51..6817d7af539c 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
@@ -14,7 +14,7 @@ abstract class MigrateUpgradeExecuteTestBase extends MigrateUpgradeTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create content.
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
index 9da21be807cc..faef691cf473 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
@@ -46,7 +46,7 @@ abstract class MigrateUpgradeTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->createMigrationConnection();
     $this->sourceDatabase = Database::getConnection('default', 'migrate_drupal_ui');
@@ -121,7 +121,7 @@ protected function createMigrationConnection() {
   /**
    * {@inheritdoc}
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     Database::removeConnection('migrate_drupal_ui');
     parent::tearDown();
   }
diff --git a/core/modules/node/tests/src/Functional/NodeTestBase.php b/core/modules/node/tests/src/Functional/NodeTestBase.php
index 44dc2faec0eb..4f3334111592 100644
--- a/core/modules/node/tests/src/Functional/NodeTestBase.php
+++ b/core/modules/node/tests/src/Functional/NodeTestBase.php
@@ -29,7 +29,7 @@ abstract class NodeTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create Basic page and Article node types.
diff --git a/core/modules/node/tests/src/Functional/Views/NodeTestBase.php b/core/modules/node/tests/src/Functional/Views/NodeTestBase.php
index 9e3062e6c854..0bbeef888e1d 100644
--- a/core/modules/node/tests/src/Functional/Views/NodeTestBase.php
+++ b/core/modules/node/tests/src/Functional/Views/NodeTestBase.php
@@ -18,7 +18,7 @@ abstract class NodeTestBase extends ViewTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     if ($import_test_views) {
diff --git a/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php b/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
index fd00a0e71c47..5265eb9e844d 100644
--- a/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
+++ b/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
@@ -25,7 +25,7 @@ class NodePreviewLinkTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $filtered_html_format = FilterFormat::create([
diff --git a/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php
index ef1d92361fab..915355df8037 100644
--- a/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php
+++ b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php
@@ -24,7 +24,7 @@ class TestSettingSummariesContentType extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $admin_user = $this->drupalCreateUser(['administer content types']);
diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeDeriverTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeDeriverTest.php
index 2794f4a61667..9eef8e2159c1 100644
--- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeDeriverTest.php
+++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeDeriverTest.php
@@ -20,7 +20,7 @@ class MigrateNodeDeriverTest extends MigrateDrupal6TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->pluginManager = $this->container->get('plugin.manager.migration');
   }
diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTestBase.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTestBase.php
index e225003d0b6b..f6a0c3893ee8 100644
--- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTestBase.php
+++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTestBase.php
@@ -13,7 +13,7 @@ abstract class MigrateNodeTestBase extends MigrateDrupal6TestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installEntitySchema('node');
diff --git a/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php b/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php
index 32eca5d6ba2b..c3ff1d6c1c1d 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php
@@ -52,7 +52,7 @@ abstract class NodeAccessTestBase extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->installSchema('system', 'sequences');
     $this->installSchema('node', 'node_access');
diff --git a/core/modules/options/tests/src/Functional/OptionsDynamicValuesTestBase.php b/core/modules/options/tests/src/Functional/OptionsDynamicValuesTestBase.php
index c188bba794ff..5a5f751dd6c7 100644
--- a/core/modules/options/tests/src/Functional/OptionsDynamicValuesTestBase.php
+++ b/core/modules/options/tests/src/Functional/OptionsDynamicValuesTestBase.php
@@ -33,7 +33,7 @@ abstract class OptionsDynamicValuesTestBase extends FieldTestBase {
    */
   protected $fieldStorage;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $field_name = 'test_options';
diff --git a/core/modules/options/tests/src/Kernel/OptionsFieldUnitTestBase.php b/core/modules/options/tests/src/Kernel/OptionsFieldUnitTestBase.php
index af4ccc342154..a4b9b0e06915 100644
--- a/core/modules/options/tests/src/Kernel/OptionsFieldUnitTestBase.php
+++ b/core/modules/options/tests/src/Kernel/OptionsFieldUnitTestBase.php
@@ -49,7 +49,7 @@ abstract class OptionsFieldUnitTestBase extends FieldKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->fieldStorageDefinition = [
diff --git a/core/modules/options/tests/src/Kernel/Views/OptionsTestBase.php b/core/modules/options/tests/src/Kernel/Views/OptionsTestBase.php
index 8be66d1c25db..5b6a55b6b953 100644
--- a/core/modules/options/tests/src/Kernel/Views/OptionsTestBase.php
+++ b/core/modules/options/tests/src/Kernel/Views/OptionsTestBase.php
@@ -48,7 +48,7 @@ abstract class OptionsTestBase extends ViewsKernelTestBase {
    */
   protected $fieldNames;
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp();
     $this->mockStandardInstall();
 
diff --git a/core/modules/path/tests/src/Functional/PathTestBase.php b/core/modules/path/tests/src/Functional/PathTestBase.php
index 3e448f2565a9..5749ff151bc9 100644
--- a/core/modules/path/tests/src/Functional/PathTestBase.php
+++ b/core/modules/path/tests/src/Functional/PathTestBase.php
@@ -19,7 +19,7 @@ abstract class PathTestBase extends BrowserTestBase {
    */
   protected static $modules = ['node', 'path'];
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create Basic page and Article node types.
diff --git a/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php
index e3341ffd0b62..e31fae1c78c3 100644
--- a/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php
+++ b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php
@@ -29,7 +29,7 @@ abstract class MigrateUrlAliasTestBase extends MigrateDrupal7TestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installEntitySchema('node');
diff --git a/core/modules/quickedit/tests/src/Kernel/QuickEditTestBase.php b/core/modules/quickedit/tests/src/Kernel/QuickEditTestBase.php
index b92af125ac4d..38a771f6d28f 100644
--- a/core/modules/quickedit/tests/src/Kernel/QuickEditTestBase.php
+++ b/core/modules/quickedit/tests/src/Kernel/QuickEditTestBase.php
@@ -43,7 +43,7 @@ abstract class QuickEditTestBase extends KernelTestBase {
   /**
    * Sets the default field storage backend for fields created during tests.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->fields = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
diff --git a/core/modules/responsive_image/tests/src/Kernel/Migrate/d7/MigrateResponsiveImageStylesTest.php b/core/modules/responsive_image/tests/src/Kernel/Migrate/d7/MigrateResponsiveImageStylesTest.php
index 95b7b31109a9..f9c877684640 100644
--- a/core/modules/responsive_image/tests/src/Kernel/Migrate/d7/MigrateResponsiveImageStylesTest.php
+++ b/core/modules/responsive_image/tests/src/Kernel/Migrate/d7/MigrateResponsiveImageStylesTest.php
@@ -20,7 +20,7 @@ class MigrateResponsiveImageStylesTest extends MigrateDrupal7TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->executeMigrations(['d7_image_styles', 'd7_responsive_image_styles']);
   }
diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
index 40c401bdf802..44fd2bd40704 100644
--- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
@@ -180,7 +180,7 @@ protected function provisionEntityResource($single_format = FALSE) {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Calculate REST Resource config entity ID.
diff --git a/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php b/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
index c5381d5cdcdb..5156e095cdac 100644
--- a/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
@@ -89,7 +89,7 @@ abstract class FileUploadResourceTestBase extends ResourceTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->fileStorage = $this->container->get('entity_type.manager')
diff --git a/core/modules/rest/tests/src/Functional/ResourceTestBase.php b/core/modules/rest/tests/src/Functional/ResourceTestBase.php
index ce509970d545..e7d487954191 100644
--- a/core/modules/rest/tests/src/Functional/ResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/ResourceTestBase.php
@@ -98,7 +98,7 @@ abstract class ResourceTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->serializer = $this->container->get('serializer');
diff --git a/core/modules/rest/tests/src/Functional/Views/RestExportAuthTest.php b/core/modules/rest/tests/src/Functional/Views/RestExportAuthTest.php
index 5f371ccfde94..dfc3595aa6d2 100644
--- a/core/modules/rest/tests/src/Functional/Views/RestExportAuthTest.php
+++ b/core/modules/rest/tests/src/Functional/Views/RestExportAuthTest.php
@@ -25,7 +25,7 @@ class RestExportAuthTest extends ViewTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp($import_test_views = TRUE): void {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     $this->drupalLogin($this->drupalCreateUser(['administer views']));
diff --git a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
index 141a517b1f3e..3da4471886b1 100644
--- a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
+++ b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
@@ -40,7 +40,7 @@ class RequestHandlerTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $serializer = $this->prophesize(SerializerInterface::class);
     $serializer->willImplement(DecoderInterface::class);
diff --git a/core/modules/serialization/tests/src/Kernel/NormalizerTestBase.php b/core/modules/serialization/tests/src/Kernel/NormalizerTestBase.php
index 7e7d554740fb..bba9f0c57a2a 100644
--- a/core/modules/serialization/tests/src/Kernel/NormalizerTestBase.php
+++ b/core/modules/serialization/tests/src/Kernel/NormalizerTestBase.php
@@ -26,7 +26,7 @@ abstract class NormalizerTestBase extends KernelTestBase {
     'user',
   ];
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installEntitySchema('entity_test_mulrev');
diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php b/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php
index bdec9903dffc..6f657030b68a 100644
--- a/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php
+++ b/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php
@@ -47,7 +47,7 @@ abstract class ShortcutTestBase extends BrowserTestBase {
    */
   protected $set;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     if ($this->profile != 'standard') {
diff --git a/core/modules/statistics/tests/src/Functional/StatisticsTestBase.php b/core/modules/statistics/tests/src/Functional/StatisticsTestBase.php
index d55db184598b..ec430bbbc355 100644
--- a/core/modules/statistics/tests/src/Functional/StatisticsTestBase.php
+++ b/core/modules/statistics/tests/src/Functional/StatisticsTestBase.php
@@ -23,7 +23,7 @@ abstract class StatisticsTestBase extends BrowserTestBase {
    */
   protected $blockingUser;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Create Basic page node type.
diff --git a/core/modules/system/tests/src/Functional/Cache/PageCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Cache/PageCacheTagsTestBase.php
index 27fabf8ba61d..5460c287dcb8 100644
--- a/core/modules/system/tests/src/Functional/Cache/PageCacheTagsTestBase.php
+++ b/core/modules/system/tests/src/Functional/Cache/PageCacheTagsTestBase.php
@@ -20,7 +20,7 @@ abstract class PageCacheTagsTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Enable page caching.
diff --git a/core/modules/system/tests/src/Functional/Database/DatabaseTestBase.php b/core/modules/system/tests/src/Functional/Database/DatabaseTestBase.php
index 9193ee1032f6..8176033ce5b1 100644
--- a/core/modules/system/tests/src/Functional/Database/DatabaseTestBase.php
+++ b/core/modules/system/tests/src/Functional/Database/DatabaseTestBase.php
@@ -18,7 +18,7 @@ abstract class DatabaseTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     DatabaseKernelTestBase::addSampleData();
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
index 9c17f03c7ca8..34019fdddb25 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
@@ -50,7 +50,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Give anonymous users permission to view test entities, so that we can
diff --git a/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php b/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php
index 9917e6333f75..64df50c21738 100644
--- a/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php
+++ b/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php
@@ -24,7 +24,7 @@ abstract class ModuleTestBase extends BrowserTestBase {
 
   protected $adminUser;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->adminUser = $this->drupalCreateUser([
diff --git a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
index fa4d1456b9e2..4452c17740e1 100644
--- a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
+++ b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
@@ -44,7 +44,7 @@ class PrepareUninstallTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $admin_user = $this->drupalCreateUser(['administer modules']);
diff --git a/core/modules/system/tests/src/Kernel/Render/ClassyTest.php b/core/modules/system/tests/src/Kernel/Render/ClassyTest.php
index 8adb4ebd9808..7d7a1d37ad80 100644
--- a/core/modules/system/tests/src/Kernel/Render/ClassyTest.php
+++ b/core/modules/system/tests/src/Kernel/Render/ClassyTest.php
@@ -19,7 +19,7 @@ class ClassyTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     // Use the classy theme.
diff --git a/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTestBase.php b/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTestBase.php
index 10c30616da4f..e5799de76b2b 100644
--- a/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTestBase.php
+++ b/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTestBase.php
@@ -30,7 +30,7 @@ abstract class TokenReplaceKernelTestBase extends EntityKernelTestBase {
    */
   protected static $modules = ['system'];
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // Install default system configuration.
     $this->installConfig(['system']);
diff --git a/core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php b/core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php
index bc1f4ee65dd0..7371aa2a2441 100644
--- a/core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php
@@ -24,7 +24,7 @@ abstract class TaxonomyTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->drupalPlaceBlock('system_breadcrumb_block');
 
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php
index 2f47bae8fb72..74b24df599aa 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php
@@ -57,7 +57,7 @@ class TaxonomyFieldFilterTest extends ViewTestBase {
    */
   public $termNames = [];
 
-  public function setUp($import_test_views = TRUE): void {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     // Add two new languages.
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php
index 5a8c22cf5fa7..083ee9e6c411 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php
@@ -55,7 +55,7 @@ abstract class TaxonomyTestBase extends ViewTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
     $this->mockStandardInstall();
 
diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularySerializationTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularySerializationTest.php
index 2386bfb5d3e7..b7fec2dec16a 100644
--- a/core/modules/taxonomy/tests/src/Functional/VocabularySerializationTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/VocabularySerializationTest.php
@@ -31,7 +31,7 @@ class VocabularySerializationTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     Vocabulary::create(['vid' => 'test'])->save();
diff --git a/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php b/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php
index a2f902fb9e51..e1f71f32beb6 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php
@@ -74,7 +74,7 @@ abstract class TaxonomyTestBase extends ViewsKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     // Install node config to create body field.
diff --git a/core/modules/tour/tests/src/Functional/TourTestBasic.php b/core/modules/tour/tests/src/Functional/TourTestBasic.php
index 2f4d9674dc8b..f0c9240bd574 100644
--- a/core/modules/tour/tests/src/Functional/TourTestBasic.php
+++ b/core/modules/tour/tests/src/Functional/TourTestBasic.php
@@ -39,7 +39,7 @@ abstract class TourTestBasic extends TourTestBase {
    */
   protected $permissions = ['access tour'];
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Make sure we are using distinct default and administrative themes for
diff --git a/core/modules/tour/tests/src/FunctionalJavascript/TourJavascriptTest.php b/core/modules/tour/tests/src/FunctionalJavascript/TourJavascriptTest.php
index 64ccd4dde0ae..51494d25e3ed 100644
--- a/core/modules/tour/tests/src/FunctionalJavascript/TourJavascriptTest.php
+++ b/core/modules/tour/tests/src/FunctionalJavascript/TourJavascriptTest.php
@@ -28,7 +28,7 @@ class TourJavascriptTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $admin_user = $this->drupalCreateUser([
diff --git a/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php b/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php
index eefdc4d52c9d..6d781b894c67 100644
--- a/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php
+++ b/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php
@@ -29,7 +29,7 @@ class TourLegacyTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $admin_user = $this->drupalCreateUser([
diff --git a/core/modules/update/tests/src/Functional/UpdateUploaderTestBase.php b/core/modules/update/tests/src/Functional/UpdateUploaderTestBase.php
index 972495444d93..d803bb3f3d94 100644
--- a/core/modules/update/tests/src/Functional/UpdateUploaderTestBase.php
+++ b/core/modules/update/tests/src/Functional/UpdateUploaderTestBase.php
@@ -12,7 +12,7 @@ class UpdateUploaderTestBase extends UpdateTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Change the root path which Update Manager uses to install and update
diff --git a/core/modules/user/tests/src/Functional/RestRegisterUserTest.php b/core/modules/user/tests/src/Functional/RestRegisterUserTest.php
index 302944f924ed..25d92624972b 100644
--- a/core/modules/user/tests/src/Functional/RestRegisterUserTest.php
+++ b/core/modules/user/tests/src/Functional/RestRegisterUserTest.php
@@ -59,7 +59,7 @@ class RestRegisterUserTest extends ResourceTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $auth = isset(static::$auth) ? [static::$auth] : [];
diff --git a/core/modules/user/tests/src/Functional/Views/AccessTestBase.php b/core/modules/user/tests/src/Functional/Views/AccessTestBase.php
index 2f302af3736b..93c6bfb1a7eb 100644
--- a/core/modules/user/tests/src/Functional/Views/AccessTestBase.php
+++ b/core/modules/user/tests/src/Functional/Views/AccessTestBase.php
@@ -45,7 +45,7 @@ abstract class AccessTestBase extends UserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
     $this->drupalPlaceBlock('system_breadcrumb_block');
 
diff --git a/core/modules/user/tests/src/Functional/Views/UserTestBase.php b/core/modules/user/tests/src/Functional/Views/UserTestBase.php
index 0760b1b43dd8..efc2a8ab1392 100644
--- a/core/modules/user/tests/src/Functional/Views/UserTestBase.php
+++ b/core/modules/user/tests/src/Functional/Views/UserTestBase.php
@@ -32,7 +32,7 @@ abstract class UserTestBase extends ViewTestBase {
    */
   protected $nodes = [];
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     ViewTestData::createTestViews(static::class, ['user_test_views']);
diff --git a/core/modules/user/tests/src/Kernel/Migrate/d6/ProfileFieldCheckRequirementsTest.php b/core/modules/user/tests/src/Kernel/Migrate/d6/ProfileFieldCheckRequirementsTest.php
index fd6b057d2c2a..d6f5866d064a 100644
--- a/core/modules/user/tests/src/Kernel/Migrate/d6/ProfileFieldCheckRequirementsTest.php
+++ b/core/modules/user/tests/src/Kernel/Migrate/d6/ProfileFieldCheckRequirementsTest.php
@@ -15,7 +15,7 @@ class ProfileFieldCheckRequirementsTest extends MigrateDrupal6TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->sourceDatabase->schema()->dropTable('profile_fields');
   }
diff --git a/core/modules/user/tests/src/Kernel/Migrate/d7/ProfileFieldCheckRequirementsTest.php b/core/modules/user/tests/src/Kernel/Migrate/d7/ProfileFieldCheckRequirementsTest.php
index 9d3c2d166c1a..4bda849e95f9 100644
--- a/core/modules/user/tests/src/Kernel/Migrate/d7/ProfileFieldCheckRequirementsTest.php
+++ b/core/modules/user/tests/src/Kernel/Migrate/d7/ProfileFieldCheckRequirementsTest.php
@@ -15,7 +15,7 @@ class ProfileFieldCheckRequirementsTest extends MigrateDrupal7TestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->sourceDatabase->schema()->dropTable('profile_field');
   }
diff --git a/core/modules/user/tests/src/Kernel/Views/UserKernelTestBase.php b/core/modules/user/tests/src/Kernel/Views/UserKernelTestBase.php
index 5180caa286f0..80e625eee6bf 100644
--- a/core/modules/user/tests/src/Kernel/Views/UserKernelTestBase.php
+++ b/core/modules/user/tests/src/Kernel/Views/UserKernelTestBase.php
@@ -38,7 +38,7 @@ abstract class UserKernelTestBase extends ViewsKernelTestBase {
    */
   protected $userStorage;
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp();
 
     ViewTestData::createTestViews(static::class, ['user_test_views']);
diff --git a/core/modules/user/tests/src/Unit/Plugin/Action/RoleUserTestBase.php b/core/modules/user/tests/src/Unit/Plugin/Action/RoleUserTestBase.php
index 668fbd09ac67..118835f1cc0e 100644
--- a/core/modules/user/tests/src/Unit/Plugin/Action/RoleUserTestBase.php
+++ b/core/modules/user/tests/src/Unit/Plugin/Action/RoleUserTestBase.php
@@ -26,7 +26,7 @@ abstract class RoleUserTestBase extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->account = $this
diff --git a/core/modules/views/tests/src/Functional/Plugin/MonthDatePluginTest.php b/core/modules/views/tests/src/Functional/Plugin/MonthDatePluginTest.php
index 3f3f2abfd253..031a34526658 100644
--- a/core/modules/views/tests/src/Functional/Plugin/MonthDatePluginTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/MonthDatePluginTest.php
@@ -48,7 +48,7 @@ class MonthDatePluginTest extends ViewTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp($import_test_views = TRUE): void {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
     $utc = new \DateTimeZone('UTC');
     $format = 'Y-m-d h:i:s';
diff --git a/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php b/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php
index edabcb016605..9550cfdceb89 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php
@@ -30,7 +30,7 @@ class ViewsBulkTest extends ViewTestBase {
    */
   protected $defaultTheme = 'stark';
 
-  public function setUp($import_test_views = TRUE): void {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     $this->drupalCreateContentType(['type' => 'page']);
diff --git a/core/modules/views/tests/src/Functional/ViewTestBase.php b/core/modules/views/tests/src/Functional/ViewTestBase.php
index beebadba2fe5..30889ef25413 100644
--- a/core/modules/views/tests/src/Functional/ViewTestBase.php
+++ b/core/modules/views/tests/src/Functional/ViewTestBase.php
@@ -29,7 +29,7 @@ abstract class ViewTestBase extends BrowserTestBase {
    */
   protected static $modules = ['views', 'views_test_config'];
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp();
     if ($import_test_views) {
       ViewTestData::createTestViews(static::class, ['views_test_config']);
diff --git a/core/modules/views/tests/src/Functional/ViewTranslationTest.php b/core/modules/views/tests/src/Functional/ViewTranslationTest.php
index 6e6cb88a8714..9df3ea7e1d2a 100644
--- a/core/modules/views/tests/src/Functional/ViewTranslationTest.php
+++ b/core/modules/views/tests/src/Functional/ViewTranslationTest.php
@@ -31,7 +31,7 @@ class ViewTranslationTest extends ViewTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp($import_test_views = TRUE): void {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     $this->enableViewsTestModule();
diff --git a/core/modules/views/tests/src/Functional/Wizard/WizardTestBase.php b/core/modules/views/tests/src/Functional/Wizard/WizardTestBase.php
index bc1dd3243c44..41812b72b3cc 100644
--- a/core/modules/views/tests/src/Functional/Wizard/WizardTestBase.php
+++ b/core/modules/views/tests/src/Functional/Wizard/WizardTestBase.php
@@ -16,7 +16,7 @@ abstract class WizardTestBase extends ViewTestBase {
    */
   protected static $modules = ['node', 'views_ui', 'block', 'rest'];
 
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     // Create and log in a user with administer views permission.
diff --git a/core/modules/views/tests/src/FunctionalJavascript/BlockExposedFilterAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/BlockExposedFilterAJAXTest.php
index 8a8e86410673..27b399434dd9 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/BlockExposedFilterAJAXTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/BlockExposedFilterAJAXTest.php
@@ -32,7 +32,7 @@ class BlockExposedFilterAJAXTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     ViewTestData::createTestViews(self::class, ['views_test_config']);
     $this->createContentType(['type' => 'page']);
diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php b/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
index 6c515446ba5b..b963c8d58c27 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
@@ -35,7 +35,7 @@ abstract class FieldFieldAccessTestBase extends ViewsKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     $this->installEntitySchema('user');
diff --git a/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php b/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php
index e3af4551378b..3ab59f3c93f8 100644
--- a/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php
+++ b/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php
@@ -44,7 +44,7 @@ abstract class ViewsKernelTestBase extends KernelTestBase {
    *   to setup some additional stuff, like fields, you need to call false and
    *   then call createTestViews for your own.
    */
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp();
 
     $this->installSchema('system', ['sequences']);
diff --git a/core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php b/core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php
index 908597e75758..be5e30d8777a 100644
--- a/core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php
@@ -25,7 +25,7 @@ class MysqlDateSqlTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->database = $this->prophesize(Connection::class)->reveal();
   }
diff --git a/core/modules/views/tests/src/Unit/Plugin/views/query/PostgresqlDateSqlTest.php b/core/modules/views/tests/src/Unit/Plugin/views/query/PostgresqlDateSqlTest.php
index 2ea1f72fcae4..e1892b961288 100644
--- a/core/modules/views/tests/src/Unit/Plugin/views/query/PostgresqlDateSqlTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/views/query/PostgresqlDateSqlTest.php
@@ -25,7 +25,7 @@ class PostgresqlDateSqlTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->database = $this->prophesize(Connection::class)->reveal();
   }
diff --git a/core/modules/views/tests/src/Unit/Plugin/views/query/SqliteDateSqlTest.php b/core/modules/views/tests/src/Unit/Plugin/views/query/SqliteDateSqlTest.php
index d07f67cbe35f..3de9ba72fae3 100644
--- a/core/modules/views/tests/src/Unit/Plugin/views/query/SqliteDateSqlTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/views/query/SqliteDateSqlTest.php
@@ -25,7 +25,7 @@ class SqliteDateSqlTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->database = $this->prophesize(Connection::class)->reveal();
   }
diff --git a/core/modules/views_ui/tests/src/Functional/UITestBase.php b/core/modules/views_ui/tests/src/Functional/UITestBase.php
index 784796eaa721..c15877fbf9b6 100644
--- a/core/modules/views_ui/tests/src/Functional/UITestBase.php
+++ b/core/modules/views_ui/tests/src/Functional/UITestBase.php
@@ -33,7 +33,7 @@ abstract class UITestBase extends ViewTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp($import_test_views = TRUE) {
+  protected function setUp($import_test_views = TRUE): void {
     parent::setUp($import_test_views);
 
     $this->enableViewsTestModule();
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php
index 197ef2c5c561..e73f25bb67c6 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php
@@ -38,7 +38,7 @@ class DisplayTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     ViewTestData::createTestViews(self::class, ['views_test_config']);
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
index 857dcf61f014..f1bc9e42e5c1 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterCriteriaTest.php
@@ -24,7 +24,7 @@ class FilterCriteriaTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $admin_user = $this->drupalCreateUser([
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php
index ab58d5f0a2fc..7a2b4c75e8e3 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/FilterOptionsTest.php
@@ -29,7 +29,7 @@ class FilterOptionsTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $admin_user = $this->drupalCreateUser([
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
index 9ca8b80a65e2..0c41a2c6843f 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
@@ -39,7 +39,7 @@ class PreviewTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     ViewTestData::createTestViews(self::class, ['views_test_config']);
diff --git a/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php b/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php
index a0058d73b608..5c04a00ba2bd 100644
--- a/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php
+++ b/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php
@@ -52,7 +52,7 @@ class WorkspaceTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $permissions = [
       'access administration pages',
diff --git a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
index 05cb76783bd2..c5ca916621e1 100644
--- a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
+++ b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
@@ -145,7 +145,7 @@ abstract class BuildTestBase extends TestCase {
   /**
    * {@inheritdoc}
    */
-  public static function setUpBeforeClass() {
+  public static function setUpBeforeClass(): void {
     parent::setUpBeforeClass();
     static::checkClassCommandRequirements();
   }
@@ -153,7 +153,7 @@ public static function setUpBeforeClass() {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     static::checkMethodCommandRequirements($this->getName());
     $this->phpFinder = new PhpExecutableFinder();
@@ -169,7 +169,7 @@ protected function setUp() {
   /**
    * {@inheritdoc}
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     parent::tearDown();
 
     $this->stopServer();
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
index 610c00dacafd..11451559f306 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
@@ -30,7 +30,7 @@ class ThrobberTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $admin_user = $this->drupalCreateUser([
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
index 20f047827351..7f92b9ed008f 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
@@ -90,7 +90,7 @@ protected function initFrontPage() {
   /**
    * {@inheritdoc}
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     if ($this->mink) {
       $status = $this->getStatus();
       if ($status === BaseTestRunner::STATUS_ERROR || $status === BaseTestRunner::STATUS_WARNING || $status === BaseTestRunner::STATUS_FAILURE) {
diff --git a/core/tests/Drupal/FunctionalTests/Image/ToolkitTestBase.php b/core/tests/Drupal/FunctionalTests/Image/ToolkitTestBase.php
index 2d86844f0483..85a7e2a45d45 100644
--- a/core/tests/Drupal/FunctionalTests/Image/ToolkitTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Image/ToolkitTestBase.php
@@ -52,7 +52,7 @@ abstract class ToolkitTestBase extends BrowserTestBase {
    */
   protected $image;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Set the image factory service.
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
index a925fc468fb8..c8b8d9a8ec4f 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
@@ -75,7 +75,7 @@ abstract class InstallerTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUpAppRoot();
 
     $this->isInstalled = FALSE;
diff --git a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
index fa0ba28ed7ba..22b6aeabc73b 100644
--- a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
@@ -125,7 +125,7 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
    * then needed to set various things such as the config directories and the
    * container that would normally be done via the installer.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUpAppRoot();
     $this->zlibInstalled = function_exists('gzopen');
 
diff --git a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
index 147c89856758..76cf0ecbdc6f 100644
--- a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
@@ -101,7 +101,7 @@ protected function getCacheBackend($bin = NULL) {
     return $this->cachebackends[$bin];
   }
 
-  protected function setUp() {
+  protected function setUp(): void {
     $this->cachebackends = [];
     $this->defaultValue = $this->randomMachineName(10);
 
@@ -110,7 +110,7 @@ protected function setUp() {
     $this->setUpCacheBackend();
   }
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     // Destruct the registered backend, each test will get a fresh instance,
     // properly emptying it here ensure that on persistent data backends they
     // will come up empty the next test.
diff --git a/core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php
index ce73c29bf3c7..774575688ae5 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php
@@ -22,7 +22,7 @@ abstract class DatabaseTestBase extends KernelTestBase {
    */
   protected $connection;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->connection = Database::getConnection();
     $this->installSchema('database_test', [
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
index daa74a9aacca..a66fca14a820 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
@@ -28,7 +28,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installEntitySchema('entity_test_no_uuid');
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php
index d5300e932a90..1834972c7357 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php
@@ -55,7 +55,7 @@ abstract class EntityKernelTestBase extends KernelTestBase {
    */
   protected $state;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->entityTypeManager = $this->container->get('entity_type.manager');
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityLanguageTestBase.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityLanguageTestBase.php
index 10eca3f91e7c..52b364a19328 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityLanguageTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityLanguageTestBase.php
@@ -41,7 +41,7 @@ abstract class EntityLanguageTestBase extends EntityKernelTestBase {
 
   protected static $modules = ['language', 'entity_test'];
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->languageManager = $this->container->get('language_manager');
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php
index bd36cad7b0c3..c6f99a11e883 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php
@@ -48,7 +48,7 @@ class EntityRepositoryTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->entityTypeManager = $this->container->get('entity_type.manager');
diff --git a/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php b/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
index ae15cde0cfd4..9deac668af29 100644
--- a/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
@@ -35,7 +35,7 @@ abstract class FileTestBase extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // \Drupal\KernelTests\KernelTestBase::bootKernel() sets a global override
     // for the default scheme because core relies on it in
diff --git a/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php
index 70a7d176282e..43b999e93fed 100644
--- a/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php
@@ -37,7 +37,7 @@ class StreamWrapperTest extends FileTestBase {
    */
   protected $classname = 'Drupal\file_test\StreamWrapper\DummyStreamWrapper';
 
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     // Add file_private_path setting.
diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php
index 40add2f5529c..a79e0232b1f7 100644
--- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php
@@ -30,7 +30,7 @@ abstract class StorageTestBase extends KernelTestBase {
    */
   protected $factory = 'keyvalue';
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Define two data collections,
diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php
index 28b762ffcc32..bb2d4dd501fb 100644
--- a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php
@@ -32,7 +32,7 @@ class ContextAwarePluginBaseTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $configuration = [
       'context' => [
diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php
index b5a7aeb2e7ff..98df3076b791 100644
--- a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php
@@ -45,7 +45,7 @@ class ContextAwarePluginTraitTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $plugin_definition = new TestContextAwarePluginDefinition();
     $plugin_definition->addContextDefinition('nato_letter', ContextDefinition::create('string'));
diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php
index a8df05585ce5..46cf470ab984 100644
--- a/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php
@@ -29,7 +29,7 @@ abstract class PluginTestBase extends KernelTestBase {
   protected $defaultsTestPluginManager;
   protected $defaultsTestPluginExpectedDefinitions;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Real modules implementing plugin types may expose a module-specific API
diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php
index 6e5269e7dbda..acff89197587 100644
--- a/core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php
@@ -24,7 +24,7 @@ class RecursiveContextualValidatorTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index 7c16534f50db..a75d45758cc0 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -229,7 +229,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa
   /**
    * {@inheritdoc}
    */
-  public static function setUpBeforeClass() {
+  public static function setUpBeforeClass(): void {
     parent::setUpBeforeClass();
     VarDumper::setHandler(TestVarDumper::class . '::cliHandler');
 
@@ -240,7 +240,7 @@ public static function setUpBeforeClass() {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Allow tests to compare MarkupInterface objects via assertEquals().
@@ -616,7 +616,7 @@ protected function getConfigSchemaExclusions() {
   /**
    * {@inheritdoc}
    */
-  protected function assertPostConditions() {
+  protected function assertPostConditions(): void {
     // Execute registered Drupal shutdown functions prior to tearing down.
     // @see _drupal_shutdown_function()
     $callbacks = &drupal_register_shutdown_function();
@@ -636,7 +636,7 @@ protected function assertPostConditions() {
   /**
    * {@inheritdoc}
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     // Destroy the testing kernel.
     if (isset($this->kernel)) {
       $this->kernel->shutdown();
diff --git a/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/ClassWriter.php b/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/ClassWriter.php
index da0854735726..dffce1d86395 100644
--- a/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/ClassWriter.php
+++ b/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/ClassWriter.php
@@ -83,11 +83,6 @@ private static function alterTestCase(ClassLoader $autoloader): void {
     $alteredCode = file_get_contents($alteredFile);
     $alteredCode = preg_replace('/abstract class TestCase[^\{]+\{/', '$0 ' . \PHP_EOL . "    use \Symfony\Bridge\PhpUnit\Legacy\PolyfillTestCaseTrait;" . \PHP_EOL, $alteredCode, 1);
     $alteredCode = str_replace("__DIR__ . '/../Util/", "'$phpunit_dir/src/Util/", $alteredCode);
-    // While Drupal still allows methods in test base classes that inherit from
-    // TestCase with no void return typehints specified, we also alter TestCase
-    // to remove the typehints.
-    // @see https://www.drupal.org/project/drupal/issues/3182103
-    $alteredCode = preg_replace('/^    ((?:protected|public)(?: static)? function \w+\(\)): void/m', '    $1', $alteredCode);
     include static::flushAlteredCodeToFile('TestCase.php', $alteredCode);
   }
 
diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php
index d4703ed2c9c2..aad64ee4542c 100644
--- a/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -223,7 +223,7 @@ abstract class BrowserTestBase extends TestCase {
   /**
    * {@inheritdoc}
    */
-  public static function setUpBeforeClass() {
+  public static function setUpBeforeClass(): void {
     parent::setUpBeforeClass();
     VarDumper::setHandler(TestVarDumper::class . '::cliHandler');
   }
@@ -363,7 +363,7 @@ protected function registerSessions() {}
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->setUpAppRoot();
@@ -443,7 +443,7 @@ protected function cleanupEnvironment() {
   /**
    * {@inheritdoc}
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     parent::tearDown();
 
     // Destroy the testing kernel.
diff --git a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/Ticket/DCOM58Test.php b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/Ticket/DCOM58Test.php
index 9423fd26b350..8f0d3f945a82 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/Ticket/DCOM58Test.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/Ticket/DCOM58Test.php
@@ -20,7 +20,7 @@
  */
 class DCOM58Test extends TestCase
 {
-    public function setUp(): void
+    protected function setUp(): void
     {
         // Some class named Entity in the global namespace.
         include __DIR__ .'/DCOM58Entity.php';
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
index cd68de55a3a3..166ad9b57fdd 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
@@ -37,7 +37,7 @@ abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Random generator.
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php b/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php
index cc0e79d0e027..007a6fa0cbd7 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php
@@ -22,7 +22,7 @@ abstract class PhpStorageTestBase extends TestCase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     vfsStream::setup('exampleDir');
     $this->directory = vfsStream::url('exampleDir');
diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
index f4f1d0ab14f0..baff42571639 100644
--- a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
+++ b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
@@ -20,7 +20,7 @@ class YamlTest extends TestCase {
    */
   protected $mockParser;
 
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->mockParser = $this->getMockBuilder('\stdClass')
       ->addMethods(['encode', 'decode', 'getFileExtension'])
@@ -28,7 +28,7 @@ public function setUp(): void {
     YamlParserProxy::setMock($this->mockParser);
   }
 
-  public function tearDown(): void {
+  protected function tearDown(): void {
     YamlParserProxy::setMock(NULL);
     parent::tearDown();
   }
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php
index 147bd98b53d6..5391087cf1c8 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php
@@ -301,7 +301,7 @@ public function createIsolatedComposerCacheDir() {
   /**
    * Calls 'tearDown' in any test that copies fixtures to transient locations.
    */
-  public function tearDown(): void {
+  public function tearDown() {
     // Remove any temporary directories that were created.
     $filesystem = new Filesystem();
     foreach ($this->tmpDirs as $dir) {
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php
index 12d45b4fe454..0d63f9898c7e 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php
@@ -22,7 +22,7 @@ class VendorHardeningPluginTest extends TestCase {
   use PhpUnitWarnings;
   use PhpUnitCompatibilityTrait;
 
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     vfsStream::setup('vendor', NULL, [
       'drupal' => [
diff --git a/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php b/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
index 05e7a51cbcf1..0ae737516eab 100644
--- a/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
@@ -45,7 +45,7 @@ class AssertLegacyTraitTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->page = $this->prophesize(DocumentElement::class);
diff --git a/core/tests/Drupal/Tests/Core/Assert/WebAssertArgumentsTest.php b/core/tests/Drupal/Tests/Core/Assert/WebAssertArgumentsTest.php
index bb5de5fc43cc..1e2476514de8 100644
--- a/core/tests/Drupal/Tests/Core/Assert/WebAssertArgumentsTest.php
+++ b/core/tests/Drupal/Tests/Core/Assert/WebAssertArgumentsTest.php
@@ -46,7 +46,7 @@ class WebAssertArgumentsTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->page = $this->prophesize(DocumentElement::class);
diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php
index b68332e34dd0..b23090b582b2 100644
--- a/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php
@@ -34,7 +34,7 @@ class SessionCacheContextTest extends UnitTestCase {
    */
   protected $session;
 
-  public function setUp(): void {
+  protected function setUp(): void {
     $this->request = new Request();
 
     $this->requestStack = new RequestStack();
diff --git a/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php b/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php
index 067a2409d3e9..c203cae17d4b 100644
--- a/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php
+++ b/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php
@@ -26,7 +26,7 @@ class GenerateThemeTest extends QuickStartTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $php_executable_finder = new PhpExecutableFinder();
     $this->php = $php_executable_finder->find();
diff --git a/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php b/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php
index ecd2a1a63695..917179c83bd9 100644
--- a/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php
+++ b/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php
@@ -49,7 +49,7 @@ class QuickStartTest extends TestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $php_executable_finder = new PhpExecutableFinder();
     $this->php = $php_executable_finder->find();
@@ -65,7 +65,7 @@ public function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  public function tearDown(): void {
+  protected function tearDown(): void {
     if ($this->testDb) {
       $test_site_directory = $this->root . DIRECTORY_SEPARATOR . $this->testDb->getTestSitePath();
       if (file_exists($test_site_directory)) {
diff --git a/core/tests/Drupal/Tests/Core/Database/Driver/mysql/ConnectionTest.php b/core/tests/Drupal/Tests/Core/Database/Driver/mysql/ConnectionTest.php
index 0b13da66f1fc..d6913c8a7056 100644
--- a/core/tests/Drupal/Tests/Core/Database/Driver/mysql/ConnectionTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/Driver/mysql/ConnectionTest.php
@@ -30,7 +30,7 @@ class ConnectionTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     $this->pdoStatement = $this->prophesize(\PDOStatement::class);
     $this->pdoConnection = $this->prophesize(\PDO::class);
   }
diff --git a/core/tests/Drupal/Tests/Core/Database/Driver/mysql/install/TasksTest.php b/core/tests/Drupal/Tests/Core/Database/Driver/mysql/install/TasksTest.php
index ab64e21a4ebb..d6ef38a27f4a 100644
--- a/core/tests/Drupal/Tests/Core/Database/Driver/mysql/install/TasksTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/Driver/mysql/install/TasksTest.php
@@ -24,7 +24,7 @@ class TasksTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     $this->connection = $this->prophesize(Connection::class);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php b/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php
index 980e715323ba..fa26aec4f690 100644
--- a/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php
@@ -23,7 +23,7 @@ abstract class BaseFieldDefinitionTestBase extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // getModuleAndPath() returns an array of the module name and directory.
diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
index f8d2db7677f1..114340c47217 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
@@ -35,7 +35,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->decoratedFormState = $this->prophesize(FormStateInterface::class);
diff --git a/core/tests/Drupal/Tests/Core/Form/FormTestBase.php b/core/tests/Drupal/Tests/Core/Form/FormTestBase.php
index 222e5a6bcaa2..6e5c89c0d2dd 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormTestBase.php
@@ -144,7 +144,7 @@ abstract class FormTestBase extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Add functions to the global namespace for testing.
@@ -195,7 +195,7 @@ protected function setUp() {
   /**
    * {@inheritdoc}
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     Html::resetSeenIds();
     (new FormState())->clearErrors();
   }
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php
index c60db3312603..41500531c41e 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php
@@ -40,7 +40,7 @@ abstract class LocalTaskIntegrationTestBase extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $container = new ContainerBuilder();
diff --git a/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php b/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
index 45132288d7cc..a3dec70ad6ac 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
@@ -43,7 +43,7 @@ abstract class LazyPluginCollectionTestBase extends UnitTestCase {
     'apple' => ['id' => 'apple', 'key' => 'value'],
   ];
 
-  protected function setUp() {
+  protected function setUp(): void {
     $this->pluginManager = $this->createMock('Drupal\Component\Plugin\PluginManagerInterface');
     $this->pluginManager->expects($this->any())
       ->method('getDefinitions')
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
index d667d1ddc8f5..8f2a251b6151 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
@@ -114,7 +114,7 @@ abstract class RendererTestBase extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->controllerResolver = $this->createMock('Drupal\Core\Controller\ControllerResolverInterface');
diff --git a/core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php b/core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php
index 162fed6eb2dd..2073865a46fe 100644
--- a/core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php
@@ -32,7 +32,7 @@ class LazyRouteCollectionTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
     $this->routeProvider = $this->createMock(RouteProviderInterface::class);
     $this->testRoutes = new \ArrayIterator([
diff --git a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
index 5852650fe8bd..764b47227eb1 100644
--- a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
@@ -71,7 +71,7 @@ class TwigExtensionTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->renderer = $this->createMock('\Drupal\Core\Render\RendererInterface');
diff --git a/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php b/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php
index cb6535320102..3f7f4f41417a 100644
--- a/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php
@@ -40,7 +40,7 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase {
   /**
    * {@inheritdoc}
    */
-  public function setUp(): void {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->tokenGenerator = $this->prophesize(CsrfTokenGenerator::class);
diff --git a/core/tests/Drupal/Tests/Listeners/DrupalListener.php b/core/tests/Drupal/Tests/Listeners/DrupalListener.php
index 0b288bce9622..758124cf8bba 100644
--- a/core/tests/Drupal/Tests/Listeners/DrupalListener.php
+++ b/core/tests/Drupal/Tests/Listeners/DrupalListener.php
@@ -28,21 +28,6 @@ class DrupalListener implements TestListener {
   use DrupalComponentTestListenerTrait;
   use DrupalStandardsListenerTrait;
 
-  /**
-   * A list of methods to be checked for void return typehint.
-   *
-   * @var string[]
-   */
-  protected $methodsWithVoidReturn = [
-    'setUpBeforeClass',
-    'setUp',
-    'assertPreConditions',
-    'assertPostConditions',
-    'tearDown',
-    'tearDownAfterClass',
-    'onNotSuccessfulTest',
-  ];
-
   /**
    * The wrapped Symfony test listener.
    *
@@ -88,21 +73,8 @@ public function startTest(Test $test): void {
     // that handles expected deprecations.
     $this->registerErrorHandler();
     $this->symfonyListener->startTest($test);
-    // Check for missing void return typehints in concrete test classes'
-    // methods. If the method is inherited from a base test class, do
-    // nothing.
-    $class = new \ReflectionClass($test);
-    foreach ($this->methodsWithVoidReturn as $method) {
-      if ($class->hasMethod($method)) {
-        $reflected_method = $class->getMethod($method);
-        if ($reflected_method->getDeclaringClass()->getName() === get_class($test)) {
-          if (!$reflected_method->hasReturnType() || $reflected_method->getReturnType()->getName() !== 'void') {
-            @trigger_error("Declaring ::$method without a void return typehint in " . get_class($test) . " is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724", E_USER_DEPRECATED);
-          }
-        }
-      }
-    }
     // Check for incorrect visibility of the $modules property.
+    $class = new \ReflectionClass($test);
     if ($class->hasProperty('modules') && !$class->getProperty('modules')->isProtected()) {
       @trigger_error('The ' . get_class($test) . '::$modules property must be declared protected. See https://www.drupal.org/node/2909426', E_USER_DEPRECATED);
     }
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index fed556fe3d1e..87a1fff781fa 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -46,7 +46,7 @@ abstract class UnitTestCase extends TestCase {
   /**
    * {@inheritdoc}
    */
-  public static function setUpBeforeClass() {
+  public static function setUpBeforeClass(): void {
     parent::setUpBeforeClass();
     VarDumper::setHandler(TestVarDumper::class . '::cliHandler');
   }
@@ -54,7 +54,7 @@ public static function setUpBeforeClass() {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // Ensure that an instantiated container in the global state of \Drupal from
     // a previous test does not leak into this test.
-- 
GitLab