diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php
index 5f454f6dacb3cbd0e92f2ae5a754fd0a1d4fda4f..87bddc258e8cd5f323019fc95ec9bc8aaefa02da 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php
@@ -48,7 +48,7 @@ protected function setUpLanguage() {
    * @return string
    *   Contents for the test .po file.
    */
-  protected function getPo($langcode) {
+  protected function getPo($langcode): string {
     return <<<PO
 msgid ""
 msgstr ""
diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
index 5d788a4e7632c7cb3859d789e1d7585032ccd985..782b73a0d753bd051fdd6d397a423395631a0e48 100644
--- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
+++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
@@ -36,7 +36,7 @@ class DateTimeFieldTest extends DateTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function getTestFieldType() {
+  protected function getTestFieldType(): string {
     return 'datetime';
   }
 
diff --git a/core/modules/datetime/tests/src/Functional/DateTimeWidgetTest.php b/core/modules/datetime/tests/src/Functional/DateTimeWidgetTest.php
index a008e4bff92c64ce93ebe0ca20523e71a62c40cd..c920e258ed7c90cae8b5fb0eb6a1116334407a40 100644
--- a/core/modules/datetime/tests/src/Functional/DateTimeWidgetTest.php
+++ b/core/modules/datetime/tests/src/Functional/DateTimeWidgetTest.php
@@ -29,7 +29,7 @@ class DateTimeWidgetTest extends DateTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function getTestFieldType() {
+  protected function getTestFieldType(): string {
     return 'datetime';
   }
 
diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
index e2b07cdc0f00c3891dce51f1c2933964a6f380e7..59d7e848fe4a39a1c7ce4cb245e276fe776d2bca 100644
--- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
+++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
@@ -49,7 +49,7 @@ class DateRangeFieldTest extends DateTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function getTestFieldType() {
+  protected function getTestFieldType(): string {
     return 'daterange';
   }
 
diff --git a/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php b/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php
index af323effb974461f45c96e008f9a48fd6e21a48c..85d54711190b16e9c023b549069563d4af9040cd 100644
--- a/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php
+++ b/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php
@@ -108,7 +108,7 @@ public function getPriority() {
    * @return string
    *   Text in the node.
    */
-  protected function extractText(TwigNodeTrans $node) {
+  protected function extractText(TwigNodeTrans $node): string {
     // Extract the singular/body and optional plural text from the
     // TwigNodeTrans object.
     $bodies = $node->getNode('body');
diff --git a/core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php b/core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php
index 53a42d82628cc933ad2bfb8befcd568dab245e0c..1ae1fab8c633d977850306c5f235f0d775f4c67b 100644
--- a/core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php
+++ b/core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php
@@ -335,7 +335,7 @@ protected function listDirectories($type) {
    * @return string
    *   The rendered topic.
    */
-  protected function renderHelpTopic(string $content, string $manner) {
+  protected function renderHelpTopic(string $content, string $manner): string {
     // Set up the special state variables for rendering.
     HelpTestTwigNodeVisitor::setStateValue('manner', $manner);
     HelpTestTwigNodeVisitor::setStateValue('max_chunk', -1);
diff --git a/core/modules/image/tests/src/Functional/ImageDimensionsTest.php b/core/modules/image/tests/src/Functional/ImageDimensionsTest.php
index dbf6ee77aa203eb3208c02fdab956b020fe26d06..c709bd81ce019918a0d85974f0b9945828033578 100644
--- a/core/modules/image/tests/src/Functional/ImageDimensionsTest.php
+++ b/core/modules/image/tests/src/Functional/ImageDimensionsTest.php
@@ -305,7 +305,7 @@ public function testImageDimensions(): void {
    * method and pass each time a fresh array so that $variables won't get
    * altered and the element is re-rendered each time.
    */
-  protected function getImageTag($variables) {
+  protected function getImageTag($variables): string {
     return str_replace("\n", '', (string) \Drupal::service('renderer')->renderRoot($variables));
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php b/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
index 5ec1d014bfbea1983b3411c92896cda8e25901a4..ca63f72a0dcfc4e97c49ebf5571c6a029899d4ca 100644
--- a/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
@@ -133,7 +133,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The 'administer node fields' permission is required.";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php b/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
index 3ea342b1e4123bfc7fa708bf2564b3a88415cd62..236c7f9eafa317461b8e5f80c35ffe5b9eaefd29 100644
--- a/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
@@ -121,7 +121,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The 'access site-wide contact form' permission is required.";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/EditorTest.php b/core/modules/jsonapi/tests/src/Functional/EditorTest.php
index 1ee00323269348689104c5d3178557b642363134..6f41f041eeb349364d7f829034a3c9d3e432928c 100644
--- a/core/modules/jsonapi/tests/src/Functional/EditorTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EditorTest.php
@@ -165,7 +165,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The 'administer filters' permission is required.";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php b/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php
index 863b9599b99ce5b7bf38fc267732491ae7c5087f..48fe43c8594f936a5b02d7cf97decce2694db451 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php
@@ -182,7 +182,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The 'administer node form display' permission is required.";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php b/core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php
index 2a19ee33aed5b047290118163ce249749e89ba8a..ce7e26ed004ed98d8e6fb88bb6a5e55f4674820c 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php
@@ -155,7 +155,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The 'administer entity_test content' permission is required.";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php b/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php
index 6504f72d1d2fb862f821a3c18386a0bd4cf3a162..c70b8b81d141890846aee3f7d14611dcde0f314b 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php
@@ -135,7 +135,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The 'administer node display' permission is required.";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php b/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php
index 85f7e3063ef609f019412f405272dd5a028cfdba..d57d745b8f9531adebb284e1ec2fbaa13a8bddf9 100644
--- a/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php
@@ -142,7 +142,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The 'administer node fields' permission is required.";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php b/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php
index aab7213e45cbb30768917f27aca2bd9769d8290b..a6a393d98bfa03dcf3ef7bafcb4f2b59c3003a04 100644
--- a/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php
@@ -121,7 +121,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The 'administer node fields' permission is required.";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
index 36f972ebc1204291bc5584d66e8fd7c06b7bdeab..139531bb80aaed6bbf5cd438e5d76b5ccf2ff827 100644
--- a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
@@ -722,7 +722,7 @@ public function testFileUploadNoConfiguration(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     switch ($method) {
       case 'GET':
         return "The current user is not allowed to view this relationship. The 'view test entity' permission is required.";
diff --git a/core/modules/jsonapi/tests/src/Functional/NodeTest.php b/core/modules/jsonapi/tests/src/Functional/NodeTest.php
index 85b38d079f19b92533dc5c38b74c649b3f121392..1db0255e2901b73ca200542be9dd2171b6af70ee 100644
--- a/core/modules/jsonapi/tests/src/Functional/NodeTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/NodeTest.php
@@ -262,7 +262,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     switch ($method) {
       case 'GET':
       case 'POST':
diff --git a/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php b/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php
index 858ed98d65f9ad959c842c382834b4d529d0f95f..e78daed47e54b39eeeffcf311b38f9b5a8aa356d 100644
--- a/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php
@@ -115,7 +115,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The 'access content' permission is required.";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php b/core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
index 2f73786a5e7b6cf3184806fb160e87f243dfd93b..b0ca708a79dbb7ce9b417445609d101e9d7b8f55 100644
--- a/core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
+++ b/core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
@@ -398,7 +398,7 @@ protected static function getResourceLink(array $resource_identifier) {
    * @return string
    *   The relationship link.
    */
-  protected static function getRelationshipLink(array $resource_identifier, $relationship_field_name) {
+  protected static function getRelationshipLink(array $resource_identifier, $relationship_field_name): string {
     return static::getResourceLink($resource_identifier) . "/relationships/$relationship_field_name";
   }
 
@@ -413,7 +413,7 @@ protected static function getRelationshipLink(array $resource_identifier, $relat
    * @return string
    *   The related resource link.
    */
-  protected static function getRelatedLink(array $resource_identifier, $relationship_field_name) {
+  protected static function getRelatedLink(array $resource_identifier, $relationship_field_name): string {
     return static::getResourceLink($resource_identifier) . "/$relationship_field_name";
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
index c07992ca8013a856810f9d2f4e8e968fe73a4784..fdff2e648499ee1c2da88342698882f4b89d82f1 100644
--- a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
+++ b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
@@ -118,7 +118,7 @@ protected function assertNormalizationEdgeCases($method, Url $url, array $reques
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return '';
   }
 
diff --git a/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php b/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php
index adaff9b9eba77353ff6e49ab92f4b16439d0d5aa..265efb5b221af557da36da77b84d6907647b270c 100644
--- a/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php
@@ -152,7 +152,7 @@ protected function getPostDocument() {
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return "The shortcut set must be the currently displayed set for the user and the user must have 'access shortcuts' AND 'customize shortcut links' permissions.";
   }
 
diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php
index 549aa1c250440944583ef83671c3a5e15775f312..8004c121b0475d3a7478c8e24c2dda139c8d7794 100644
--- a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php
+++ b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php
@@ -95,7 +95,7 @@ public function label() {
   /**
    * Returns the name to be used to store in the config system.
    */
-  protected function getConfigName() {
+  protected function getConfigName(): string {
     return 'layout_builder_test.' . $this->getStorageType() . '.' . $this->getStorageId();
   }
 
diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php
index a006aa29d6a97fa3cc15cd7343b814ae493f184a..570bdee7a135c404a3c8d8d8d8f73d2f8b20b0d9 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php
@@ -258,7 +258,7 @@ protected function getFileHrefAccessibleOnNode(FileInterface $file): string {
    * @return string
    *   The text secret.
    */
-  protected function getFileSecret(FileInterface $file) {
+  protected function getFileSecret(FileInterface $file): string {
     return "The secret in {$file->label()}";
   }
 
diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderOptInTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderOptInTest.php
index e0664917c55437b7b2aac40c1b72b05e1f2a4ce3..f5e106cfc9ac5bcbf5bae5b0e42c707c79e3462b 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderOptInTest.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderOptInTest.php
@@ -172,7 +172,7 @@ public function testDefaultValues(): void {
    * @return string
    *   The path.
    */
-  protected function getPathForFieldBlock($entity_type_id, $bundle, $view_mode, $field_name) {
+  protected function getPathForFieldBlock($entity_type_id, $bundle, $view_mode, $field_name): string {
     $delta = 0;
     /** @var \Drupal\layout_builder\Entity\LayoutEntityDisplayInterface $display */
     $display = $this->container->get('entity_type.manager')->getStorage('entity_view_display')->load("$entity_type_id.$bundle.$view_mode");
diff --git a/core/modules/link/tests/src/Functional/LinkFieldTest.php b/core/modules/link/tests/src/Functional/LinkFieldTest.php
index c619a772ad4e3938b7cf154dd8dbc33559cd575a..5def40709141c548e48df3683561a5649c82688a 100644
--- a/core/modules/link/tests/src/Functional/LinkFieldTest.php
+++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php
@@ -1056,7 +1056,7 @@ public function testNoLinkUri(): void {
    * @return string
    *   The rendered HTML output.
    */
-  protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) {
+  protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE): string {
     if ($reset) {
       $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
     }
diff --git a/core/modules/locale/tests/src/Functional/LocaleNonInteractiveDevInstallTest.php b/core/modules/locale/tests/src/Functional/LocaleNonInteractiveDevInstallTest.php
index 328122afaf2b75df7ce2cd5b1e7fc4b00dd158fa..af7b96a4f43428a091163efbd80d3e18ad77b683 100644
--- a/core/modules/locale/tests/src/Functional/LocaleNonInteractiveDevInstallTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleNonInteractiveDevInstallTest.php
@@ -19,7 +19,7 @@ class LocaleNonInteractiveDevInstallTest extends LocaleNonInteractiveInstallTest
   /**
    * {@inheritdoc}
    */
-  protected function getVersionStringToTest() {
+  protected function getVersionStringToTest(): string {
     include_once $this->root . '/core/includes/install.core.inc';
     $version = _install_get_version_info(\Drupal::VERSION);
     return $version['major'] . '.' . $version['minor'] . '.x';
diff --git a/core/modules/locale/tests/src/Functional/LocaleNonInteractiveInstallTest.php b/core/modules/locale/tests/src/Functional/LocaleNonInteractiveInstallTest.php
index 43761ced26262f33d7dfa751d0212dc52c205e92..41f55ad80dfb9e8f695a6bfb268a490137aba55d 100644
--- a/core/modules/locale/tests/src/Functional/LocaleNonInteractiveInstallTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleNonInteractiveInstallTest.php
@@ -32,7 +32,7 @@ protected function setUp(): void {
    * @return string
    *   The version string to test, for example, '8.0.0' or '8.6.x'.
    */
-  protected function getVersionStringToTest() {
+  protected function getVersionStringToTest(): string {
     include_once $this->root . '/core/includes/install.core.inc';
     $version = _install_get_version_info(\Drupal::VERSION);
     return $version['major'] . '.0.0';
diff --git a/core/modules/media/tests/src/Traits/OEmbedTestTrait.php b/core/modules/media/tests/src/Traits/OEmbedTestTrait.php
index 0219be2007fcdcbd196dfe62436442ebe60af650..273b2513301abb19c2520af702cbd96c92537bf5 100644
--- a/core/modules/media/tests/src/Traits/OEmbedTestTrait.php
+++ b/core/modules/media/tests/src/Traits/OEmbedTestTrait.php
@@ -18,7 +18,7 @@ trait OEmbedTestTrait {
    *
    * @return string
    */
-  protected function getFixturesDirectory() {
+  protected function getFixturesDirectory(): string {
     return \Drupal::service('extension.list.module')->getPath('media') . '/tests/fixtures/oembed';
   }
 
@@ -27,7 +27,7 @@ protected function getFixturesDirectory() {
    *
    * @return string
    */
-  protected function getFixturesUrl() {
+  protected function getFixturesUrl(): string {
     return $this->baseUrl . '/' . $this->getFixturesDirectory();
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/CredentialFormTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/CredentialFormTest.php
index 7d7950911b90143afd737d7a850e334dc246c401..8f090901c1c7903895203659630c408720d9f79a 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/CredentialFormTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/CredentialFormTest.php
@@ -102,7 +102,7 @@ public static function providerCredentialForm() {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     $version = $this->getLegacyDrupalVersion($this->sourceDatabase);
     return __DIR__ . '/d' . $version . '/files';
   }
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php
index 2dfab8159c786f032aea09d2f8cad599b5bdd0d4..481be87095239425ce9c57b7a5d5d38280763e16 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php
@@ -41,7 +41,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/SourceProviderTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/SourceProviderTest.php
index b82af20b89fd0e30ebed71e670335744597f8bb8..fd1d06f9c569615aaf7f7c5d16fd82d2b7a21c84 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/SourceProviderTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/SourceProviderTest.php
@@ -71,7 +71,7 @@ public static function providerSourceProvider() {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return '';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/IdConflictTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/IdConflictTest.php
index 8904bc3e1d057bf48da25d720be5b555b0ea324e..bfcb32227710ce3a7b91211119153e610b48b0e9 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/IdConflictTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/IdConflictTest.php
@@ -35,7 +35,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MultilingualReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MultilingualReviewPageTest.php
index c359d2479a66a8bf957b1e6617e6d5ab2c7b02db..6c0a5e066002265af71ec3d3dbffd8dd83d43dd4 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MultilingualReviewPageTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MultilingualReviewPageTest.php
@@ -47,7 +47,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NoMultilingualReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NoMultilingualReviewPageTest.php
index 5b605a69fc57572c6e6962c34c7e4f8dfec09a82..d66397fb66f76bac21183ecf0b3e88fe9a945b5a 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NoMultilingualReviewPageTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NoMultilingualReviewPageTest.php
@@ -43,7 +43,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php
index 1e2284a242a6c32a15ac79e37c189a89db156591..c071da3f2b7700afc526202a164fbf47ab2b051e 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php
@@ -42,7 +42,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
index c2cabe175d0fbaac8ab22e6462d640203d13d56e..d1934c63c1cbbbc76ba36df85baaca7f61c30a30 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
@@ -64,7 +64,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/DoubleSlashTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/DoubleSlashTest.php
index 940869b3aecbb4de58206d5553cf7c2ae55ead14..1be5c617eb1f4eab86697162e69e222bea69711a 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/DoubleSlashTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/DoubleSlashTest.php
@@ -82,7 +82,7 @@ public function testMigrateUpgradeExecute(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/FilePathTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/FilePathTest.php
index b00490702e149de81f1e6e15d5b095fd5ca924fa..54fd40b62328d9f46b6a1f163f0b8e71759371b3 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/FilePathTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/FilePathTest.php
@@ -317,7 +317,7 @@ protected function getMissingPaths() {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return '';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/IdConflictTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/IdConflictTest.php
index 38bd909f992852d9b7e917f6a867677e594cca22..12da618859b93e0e0744f4a35a72b7b48aeca2bc 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/IdConflictTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/IdConflictTest.php
@@ -35,7 +35,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MultilingualReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MultilingualReviewPageTest.php
index 1dd88c53e29ce621b1676321776de313f1671d75..0ba0d3fd89c7bf8a4e46965284d517c0027671be 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MultilingualReviewPageTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MultilingualReviewPageTest.php
@@ -44,7 +44,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/NoMultilingualReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/NoMultilingualReviewPageTest.php
index e8039f45ebeba8780f64c374856a979393af6d49..b8878590433a1b00b0f11f08d01aa4fee490b5aa 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/NoMultilingualReviewPageTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/NoMultilingualReviewPageTest.php
@@ -41,7 +41,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
index e6020ccb2f0fb01a4c85552e4495d32cc599cdb5..1c5068fb276e1e9cdd5f8254f3b11a9424a18be6 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
@@ -67,7 +67,7 @@ protected function setUp(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getSourceBasePath() {
+  protected function getSourceBasePath(): string {
     return __DIR__ . '/files';
   }
 
diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
index af730fbd343ca4c02a3e25f82adbca156a319168..27aac58063dffb41c0a7a67569b46793e8d4da7c 100644
--- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
+++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
@@ -457,7 +457,7 @@ protected function doTestAlternateHreflangLinks(Node $node) {
   /**
    * {@inheritdoc}
    */
-  protected function getFormSubmitSuffix(EntityInterface $entity, $langcode) {
+  protected function getFormSubmitSuffix(EntityInterface $entity, $langcode): string {
     if (!$entity->isNew() && $entity->isTranslatable()) {
       $translations = $entity->getTranslationLanguages();
       if ((count($translations) > 1 || !isset($translations[$langcode])) && ($field = $entity->getFieldDefinition('status'))) {
diff --git a/core/modules/path/tests/src/Unit/Field/PathFieldDefinitionTest.php b/core/modules/path/tests/src/Unit/Field/PathFieldDefinitionTest.php
index 9b4c3f61d2c4c010fa30b9395dd86c7da9fa5f40..e20f44f7de207c0e62ea11f789bd6e05017f70c3 100644
--- a/core/modules/path/tests/src/Unit/Field/PathFieldDefinitionTest.php
+++ b/core/modules/path/tests/src/Unit/Field/PathFieldDefinitionTest.php
@@ -15,7 +15,7 @@ class PathFieldDefinitionTest extends BaseFieldDefinitionTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function getPluginId() {
+  protected function getPluginId(): string {
     return 'path';
   }
 
diff --git a/core/modules/settings_tray/tests/src/Functional/SettingsTrayTest.php b/core/modules/settings_tray/tests/src/Functional/SettingsTrayTest.php
index d759696e9ea7e0b573ab680592bf9fc763e663c9..c9cc4ffa41e84668e2b867e272f344c48c475bfa 100644
--- a/core/modules/settings_tray/tests/src/Functional/SettingsTrayTest.php
+++ b/core/modules/settings_tray/tests/src/Functional/SettingsTrayTest.php
@@ -36,7 +36,7 @@ class SettingsTrayTest extends BrowserTestBase {
    * @return string
    *   The CSS selector.
    */
-  protected function getBlockSelector(Block $block) {
+  protected function getBlockSelector(Block $block): string {
     return '#block-' . $block->id();
   }
 
diff --git a/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php b/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php
index c3d617976ef6732cabf2e41c8e230a9369a575a5..47599fb0bc025ef25e9eab7a7a7698ea599f5b3d 100644
--- a/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php
+++ b/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php
@@ -37,7 +37,7 @@ protected function setUp(): void {
   /**
    * Return the build id of the current form.
    */
-  protected function getFormBuildId() {
+  protected function getFormBuildId(): string {
     // Ensure the hidden 'form_build_id' field is unique.
     $this->assertSession()->elementsCount('xpath', '//input[@name="form_build_id"]', 1);
     return (string) $this->assertSession()->hiddenFieldExists('form_build_id')->getAttribute('value');
diff --git a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php
index 12dade7f2098d79f4a95904280a85541946e1910..ceee8c4ce4d9509edbb2999a8390788fab6ad828 100644
--- a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php
+++ b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php
@@ -232,7 +232,7 @@ protected function loginHttps(AccountInterface $account) {
    * @return string
    *   The internal path from the location header on the response.
    */
-  protected function getPathFromLocationHeader(ResponseInterface $response, $https = FALSE) {
+  protected function getPathFromLocationHeader(ResponseInterface $response, $https = FALSE): string {
     if ($https) {
       $base_url = str_replace('http://', 'https://', $this->baseUrl);
     }
@@ -276,7 +276,7 @@ protected function assertSessionIds(string $sid, string $assertion_text): void {
    * @return string
    *   URL prepared for the https.php mock front controller.
    */
-  protected function httpsUrl($url) {
+  protected function httpsUrl($url): string {
     return 'core/modules/system/tests/https.php/' . $url;
   }
 
@@ -289,7 +289,7 @@ protected function httpsUrl($url) {
    * @return string
    *   URL prepared for the http.php mock front controller.
    */
-  protected function httpUrl($url) {
+  protected function httpUrl($url): string {
     return 'core/modules/system/tests/http.php/' . $url;
   }
 
@@ -314,7 +314,7 @@ protected function getGuzzleCookieJar() {
    * @return string
    *   The form build ID for the user login form.
    */
-  protected function getUserLoginFormBuildId() {
+  protected function getUserLoginFormBuildId(): string {
     $this->drupalGet('user/login');
     return (string) $this->getSession()->getPage()->findField('form_build_id');
   }
diff --git a/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php b/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php
index 09bb7143667b2880b4fb5b304b32cbabc2168cc3..df7fd6d5c7be07a0e9e57f12dbf54bc10ce90cc0 100644
--- a/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php
+++ b/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php
@@ -115,7 +115,7 @@ protected function makeWritable($site_path) {
    * @return string
    *   The path to settings.php.
    */
-  protected function settingsFile($site_path) {
+  protected function settingsFile($site_path): string {
     $settings_file = $site_path . '/settings.php';
     return $settings_file;
   }
diff --git a/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php b/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
index 651d9d2a7fd2a1ed5c5bb351ba35735821bab299..ad012990c0385c02cc1ba3dc625eb4db33191db4 100644
--- a/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
+++ b/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
@@ -258,7 +258,7 @@ protected function assertNormalizationEdgeCases($method, Url $url, array $reques
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
+  protected function getExpectedUnauthorizedAccessMessage($method): string {
     return '';
   }
 
diff --git a/core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php b/core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php
index ec3842528bc541b92deb97c7a5ae30f33c105ee7..008dfad6aadae4196d93ad0e4e4e762944ca46a8 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php
@@ -47,7 +47,7 @@ public function testMappedOutput(): void {
    * @return string
    *   The view rendered as HTML.
    */
-  protected function mappedOutputHelper(ViewExecutable $view) {
+  protected function mappedOutputHelper(ViewExecutable $view): string {
     $output = $view->preview();
     $rendered_output = (string) \Drupal::service('renderer')->renderRoot($output);
     $this->storeViewPreview($rendered_output);
diff --git a/core/profiles/demo_umami/tests/src/Functional/UmamiMultilingualInstallTest.php b/core/profiles/demo_umami/tests/src/Functional/UmamiMultilingualInstallTest.php
index b01f7d68c1ba07b207535528062da0a3720e5ba9..b10f69dc2095523ddcdb51a95395e0279fefd146 100644
--- a/core/profiles/demo_umami/tests/src/Functional/UmamiMultilingualInstallTest.php
+++ b/core/profiles/demo_umami/tests/src/Functional/UmamiMultilingualInstallTest.php
@@ -53,7 +53,7 @@ protected function setUpLanguage() {
    * @return string
    *   Contents for the test .po file.
    */
-  protected function getPo($langcode) {
+  protected function getPo($langcode): string {
     return <<<PO
 msgid ""
 msgstr ""
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
index 1d5f9aa2e54e80b648916963fc58d84a45d09917..544e58205cd14e628413a16679ba1de0e12ba7a5 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
@@ -536,7 +536,7 @@ public function assertEscaped($raw) {
    *
    * @see Drupal\Component\Utility\Html::escape()
    */
-  protected function escapeHtml($raw) {
+  protected function escapeHtml($raw): string {
     return htmlspecialchars($raw, ENT_NOQUOTES | ENT_SUBSTITUTE, 'UTF-8');
   }
 
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php
index c3a4e6308738c304e9815b8d814b74409e4819f9..e08e1c27b1d201ea70f7a34c586f42b3c258e241 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php
@@ -52,7 +52,7 @@ protected function installModulesFromClassProperty(ContainerInterface $container
   /**
    * {@inheritdoc}
    */
-  protected function getMinkDriverArgs() {
+  protected function getMinkDriverArgs(): string {
     return $this->doGetMinkDriverArgs();
   }
 
diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php
index b895f7caa4b4819c3852eca210f5fe9987aa93a4..0e58711f4e38fb3e147fb71dea6c3d20238855b0 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php
@@ -133,7 +133,7 @@ public function testInstalled(): void {
    * @return string
    *   Contents for the test .po file.
    */
-  protected function getPo($langcode) {
+  protected function getPo($langcode): string {
     return <<<PO
 msgid ""
 msgstr ""
diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php
index 0dd028e5ad05c2ceb1af0b4eae13f3bcf1a6ffbd..3bb2b27995df83c2de76ff2556f50a12684f01ed 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php
@@ -123,7 +123,7 @@ public function testInstalled(): void {
    * @return string
    *   Contents for the test .po file.
    */
-  protected function getPo($langcode) {
+  protected function getPo($langcode): string {
     return <<<PO
 msgid ""
 msgstr ""
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php
index 213003301bf1dd4fc241d3193fac3f44f4c85341..8125da5bca05d59ed2ab0ddc0b68cc41514477bc 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php
@@ -21,7 +21,7 @@ class InstallerExistingConfigMultilingualTest extends InstallerConfigDirectoryTe
   /**
    * {@inheritdoc}
    */
-  protected function getConfigLocation() {
+  protected function getConfigLocation(): string {
     return __DIR__ . '/../../../fixtures/config_install/multilingual';
   }
 
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php
index 3f3f1aa36adbbffc851ccff833e61ab98c9eef21..2d5ac5c1c37d9694a674e83f75e8c66104466b36 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php
@@ -28,7 +28,7 @@ protected function setUpSite() {
   /**
    * {@inheritdoc}
    */
-  protected function getConfigLocation() {
+  protected function getConfigLocation(): string {
     return __DIR__ . '/../../../fixtures/config_install/testing_config_install_no_config';
   }
 
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
index 0631be6381f0049b19c8e4e830a14d6b5bc62b42..4af5caa3d17fe541b29b533950ff6ae68883acb6 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
@@ -44,7 +44,7 @@ public function testConfigSync(): void {
   /**
    * {@inheritdoc}
    */
-  protected function getConfigLocation() {
+  protected function getConfigLocation(): string {
     return __DIR__ . '/../../../fixtures/config_install/testing_config_install';
   }
 
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php
index 13232d628a19d289d8b8dc88ac08e2f88bd81ca3..98f6ed3f3ed4fe9470b127b9d3ac3f776cc81ca6 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php
@@ -55,7 +55,7 @@ protected function setUpSite() {
   /**
    * {@inheritdoc}
    */
-  protected function getConfigLocation() {
+  protected function getConfigLocation(): string {
     // We're not going to get to the config import stage so this does not
     // matter.
     return __DIR__ . '/../../../fixtures/config_install/testing_config_install_no_config';
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php
index 73ca469a7e1c490b1907e44a64491ffe1cf1826d..d1a9bba36c35516245e3b69317131497fa25b913 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php
@@ -43,7 +43,7 @@ protected function setUpProfile() {
   /**
    * {@inheritdoc}
    */
-  protected function getConfigLocation() {
+  protected function getConfigLocation(): string {
     return __DIR__ . '/../../../fixtures/config_install/multilingual';
   }
 
@@ -195,7 +195,7 @@ public function testConfigSync(): void {
    * @return string
    *   Contents for the test .po file.
    */
-  protected function getPo($langcode) {
+  protected function getPo($langcode): string {
     return <<<PO
 msgid ""
 msgstr ""
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstall.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstall.php
index a0601e3505996020c5ddb21596f45a159c162e39..dc68050ae5dd6403d20c42da754acae32d811662 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstall.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstall.php
@@ -74,7 +74,7 @@ protected function setUpSite() {
   /**
    * {@inheritdoc}
    */
-  protected function getConfigLocation() {
+  protected function getConfigLocation(): string {
     return __DIR__ . '/../../../fixtures/config_install/multilingual';
   }
 
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php
index bd194ee0f1341d9aba73d22a8c7d2a5403efe090..e63254cd338ab616805fac29d32ec33571faccac 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php
@@ -29,7 +29,7 @@ class InstallerExistingConfigSyncDirectoryProfileMismatchTest extends InstallerC
   /**
    * {@inheritdoc}
    */
-  protected function getConfigLocation() {
+  protected function getConfigLocation(): string {
     return __DIR__ . '/../../../fixtures/config_install/multilingual';
   }
 
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php
index 2c3190f151499b27528db38e5fa2ab52e54425eb..eea0eba64a1ca02aaa7dba060189139f7979e7e0 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php
@@ -37,7 +37,7 @@ public function setUpSettings() {
   /**
    * {@inheritdoc}
    */
-  protected function getConfigLocation() {
+  protected function getConfigLocation(): string {
     return __DIR__ . '/../../../fixtures/config_install/testing_config_install';
   }
 
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php
index 6c4ad5c6d83ad771ecb8092e96b1d703734811cf..9463ef7090ca9f12d422b02ca49e4e0c62efd741 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php
@@ -47,7 +47,7 @@ protected function prepareEnvironment() {
    * @return string
    *   Contents for the test .po file.
    */
-  protected function getPo($langcode) {
+  protected function getPo($langcode): string {
     return <<<PO
 msgid ""
 msgstr ""
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php
index bb2f5fb381c025c01c54be566da30e6f448831e1..0f9f0676cef9fdc73a2a9bebcdaacd5e75ea8019 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php
@@ -44,7 +44,7 @@ protected function setUpLanguage() {
    * @return string
    *   Contents for the test .po file.
    */
-  protected function getPo($langcode) {
+  protected function getPo($langcode): string {
     return <<<PO
 msgid ""
 msgstr ""
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php
index f085ae3d034c73ec196daab1283e528b9f914a21..03b42c2ffd316da816f95a229585f1942c80ab45 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php
@@ -76,7 +76,7 @@ public function testInstaller(): void {
    * @return string
    *   Contents for the test .po file.
    */
-  protected function getPo($langcode) {
+  protected function getPo($langcode): string {
     return <<<PO
 msgid ""
 msgstr ""
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php
index fa9368b2e9d49be9a9ec91eb272d69765a0cf6d0..7cc32bd6e08156f7b6210c7a2b1ecd6ca6cfc0d2 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php
@@ -154,7 +154,7 @@ public function testInstaller(): void {
    * @return string
    *   Contents for the test .po file.
    */
-  protected function getPo($langcode) {
+  protected function getPo($langcode): string {
     return <<<PO
 msgid ""
 msgstr ""
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php
index 81338be40ebc4d1b367dd8a1045b5e07fc1fd766..4717b9801e639174a37c78a8522e25bf79fffc88 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php
@@ -469,7 +469,7 @@ protected function doEditStep($active_langcode, $default_revision, $untranslatab
    * @return string
    *   A revision label.
    */
-  protected function generateNewEntityLabel(ContentEntityInterface $revision, $previous_revision_id, $next = FALSE) {
+  protected function generateNewEntityLabel(ContentEntityInterface $revision, $previous_revision_id, $next = FALSE): string {
     $language_label = $revision->language()->getName();
     $revision_type = $revision->isDefaultRevision() ? 'Default' : 'Pending';
     $revision_id = $next ? $this->storage->getLatestRevisionId($revision->id()) + 1 : $revision->getLoadedRevisionId();
diff --git a/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php b/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php
index 0ce61082fd1809114316a1e5906b832a6d6c0d59..8ef4c290f62692005a2df3c1241a722eefb16bee 100644
--- a/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php
+++ b/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php
@@ -83,7 +83,7 @@ trait BrowserHtmlDebugTrait {
    * @return string
    *   The formatted HTML string.
    */
-  protected function formatHtmlOutputHeaders(array $headers) {
+  protected function formatHtmlOutputHeaders(array $headers): string {
     $flattened_headers = array_map(function ($header) {
       if (is_array($header)) {
         return implode(';', array_map('trim', $header));
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/PhpArrayDumperTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/PhpArrayDumperTest.php
index 1005b57deea0ddc30264428bea11fa66c53e4719..822a1019ed16e72e02b57d3302c0764dc0940dda 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/PhpArrayDumperTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/PhpArrayDumperTest.php
@@ -31,7 +31,7 @@ protected static function serializeDefinition(array $service_definition) {
   /**
    * {@inheritdoc}
    */
-  protected static function getServiceCall($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+  protected static function getServiceCall($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): string {
     if ($invalid_behavior !== ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
       return sprintf('@?%s', $id);
     }
@@ -42,7 +42,7 @@ protected static function getServiceCall($id, $invalid_behavior = ContainerInter
   /**
    * {@inheritdoc}
    */
-  protected static function getParameterCall($name) {
+  protected static function getParameterCall($name): string {
     return '%' . $name . '%';
   }
 
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php
index 03cb68a3dc0537c77bb07cda8bf9fa1f599e72ef..99113913a7f2e8823d022ab5fc78ff5a19c133a6 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php
@@ -27,7 +27,7 @@ protected function setUp(): void {
   /**
    * Helper function to return a service definition.
    */
-  protected function getServiceCall($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+  protected function getServiceCall($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): string {
     if ($invalid_behavior !== ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
       return sprintf('@?%s', $id);
     }
@@ -38,7 +38,7 @@ protected function getServiceCall($id, $invalid_behavior = ContainerInterface::E
   /**
    * Helper function to return a service definition.
    */
-  protected function getParameterCall($name) {
+  protected function getParameterCall($name): string {
     return '%' . $name . '%';
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php
index ccfd520b1274a9de9c80ae12e46ec2f602f8c027..bc0783b3b226a9a6359a2b235e355bde90fc5ccb 100644
--- a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php
+++ b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php
@@ -191,7 +191,7 @@ protected function assertWeights(array $graph, array $expected_orders): void {
    * @param $keys
    *   (optional) Whether to output the keys of $paths instead of the values.
    */
-  protected function displayArray($paths, $keys = FALSE) {
+  protected function displayArray($paths, $keys = FALSE): string {
     if (!empty($paths)) {
       return implode(', ', $keys ? array_keys($paths) : $paths);
     }
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ExecTrait.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ExecTrait.php
index 976005a31ffce104ae793160f350243311f280c3..142ebbf52f2b11e4709977263d81e1faf7ee52ef 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ExecTrait.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ExecTrait.php
@@ -24,7 +24,7 @@ trait ExecTrait {
    * @return string
    *   Standard output from the command
    */
-  protected function mustExec($cmd, $cwd, array $env = []) {
+  protected function mustExec($cmd, $cwd, array $env = []): string {
     $process = Process::fromShellCommandline($cmd, $cwd, $env + ['PATH' => getenv('PATH'), 'HOME' => getenv('HOME')]);
     $process->setTimeout(300)->setIdleTimeout(300)->run();
     $exitCode = $process->getExitCode();
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php
index c142888eac32b58d27196ec55a816999d080e95b..6079fd4f042925420055f6a28a1968a1bec32e9d 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php
@@ -84,7 +84,7 @@ protected function tearDown(): void {
    * @return string
    *   The path to the fixture directory.
    */
-  protected function createSutWithGit($fixture_name) {
+  protected function createSutWithGit($fixture_name): string {
     $this->fixturesDir = $this->fixtures->tmpDir($this->name());
     $sut = $this->fixturesDir . '/' . $fixture_name;
     $replacements = ['SYMLINK' => 'false', 'PROJECT_ROOT' => $this->projectRoot];
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
index 1afe95c5e57ffd7929da04ef42bc8a638fa02ffc..fd7a1388831011178d8aa145308b15a71d9a2da1 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
@@ -92,7 +92,7 @@ protected function tearDown(): void {
    * @return string
    *   The path to the created System-Under-Test.
    */
-  protected function createSut($fixture_name, array $replacements = []) {
+  protected function createSut($fixture_name, array $replacements = []): string {
     $sut = $this->fixturesDir . '/' . $fixture_name;
     // Erase just our sut, to ensure it is clean. Recopy all of the fixtures.
     $this->fileSystem->remove($sut);
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php
index 58a39e7fa7b5a6649991d4c69f808fb9977e40a1..a089d3ae08bf7069a747540cc8250ef0223ebbb5 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php
@@ -116,7 +116,7 @@ public function testScaffoldUpgrade(): void {
    * @return string
    *   Path to temporary git repository.
    */
-  protected function createTmpRepo($source, $destParent, $version) {
+  protected function createTmpRepo($source, $destParent, $version): string {
     $target = $destParent . '/' . basename($source);
     $filesystem = new Filesystem();
     $filesystem->copy($source, $target);
diff --git a/core/tests/Drupal/Tests/ComposerIntegrationTest.php b/core/tests/Drupal/Tests/ComposerIntegrationTest.php
index 5e2170b6b6176d2554287faa3c1ae99e7bd0d12f..0d07a3dc590335fa42130ab4176797096055f7ee 100644
--- a/core/tests/Drupal/Tests/ComposerIntegrationTest.php
+++ b/core/tests/Drupal/Tests/ComposerIntegrationTest.php
@@ -218,7 +218,7 @@ public function testExpectedScaffoldFiles($destRelPath, $sourceRelPath, $expecte
    *
    * @return string
    */
-  protected static function getContentHash($composerFileContents)
+  protected static function getContentHash($composerFileContents): string
   {
     $content = json_decode($composerFileContents, true);
 
diff --git a/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php b/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php
index 61b058b7e2f2bd73352579563de39eff6d279724..1c7a34ac43d50761c65d6c43cb7ab4050c1e2487 100644
--- a/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php
@@ -434,7 +434,7 @@ public function testIncompatibleVariationsException(): void {
    * @return string
    *   The correct cache ID.
    */
-  protected function getSortedCacheId($cache_id_parts) {
+  protected function getSortedCacheId($cache_id_parts): string {
     sort($cache_id_parts);
     array_unshift($cache_id_parts, $this->cacheIdBase);
     return implode(':', $cache_id_parts);
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php
index a3e5953ea580308399721cb359144936872ce96f..3cd018285c0e1cf892b085c0a0c2457a7a8a61a9 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php
@@ -452,7 +452,7 @@ public function testGetDefinitionInvalidException(): void {
    * @return string
    *   A mock controller class name.
    */
-  protected function getTestHandlerClass() {
+  protected function getTestHandlerClass(): string {
     return get_class($this->getMockForAbstractClass(EntityHandlerBase::class));
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
index c70a98aded4f5a1993e40a2e33e15928ab5a10a4..d334ed95176f53e50d0ccbb7ff386dfb0b1ac3dd 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
@@ -446,7 +446,7 @@ public static function providerTestGetBundleLabel() {
    * @return string
    *   A mock controller class name.
    */
-  protected function getTestHandlerClass() {
+  protected function getTestHandlerClass(): string {
     return get_class($this->getMockForAbstractClass('Drupal\Core\Entity\EntityHandlerBase'));
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php
index 93a4e1942e875c4ccb45d0eaa33aebf57811457b..b7c4e927dc3d8d7d9590200d23689c6e3af741b9 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php
@@ -112,7 +112,7 @@ protected function themeManager() {
     return $this->themeManager;
   }
 
-  protected function getType() {
+  protected function getType(): string {
     return 'the_type';
   }
 
diff --git a/core/tests/Drupal/Tests/RandomGeneratorTrait.php b/core/tests/Drupal/Tests/RandomGeneratorTrait.php
index 5a5d26893453ad17ef285f998679c65605b68f00..a4a0139d1dabe8c3e088cdc5175d4855b735fdae 100644
--- a/core/tests/Drupal/Tests/RandomGeneratorTrait.php
+++ b/core/tests/Drupal/Tests/RandomGeneratorTrait.php
@@ -69,7 +69,7 @@ public function randomStringValidate($string) {
    *
    * @see \Drupal\Component\Utility\Random::name()
    */
-  protected function randomMachineName($length = 8) {
+  protected function randomMachineName($length = 8): string {
     return Random::machineName($length);
   }
 
diff --git a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php
index fde673dcff4863259f061fbf6e7948f86d342556..0be3b942c637b7b753b3671492561e05d270fa6b 100644
--- a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php
+++ b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php
@@ -299,7 +299,7 @@ public function testUserLogin(): void {
    * @return string
    *   The database key of the added connection.
    */
-  protected function addTestDatabase($db_prefix) {
+  protected function addTestDatabase($db_prefix): string {
     $database = Database::convertDbUrlToConnectionInfo(getenv('SIMPLETEST_DB'), $this->root);
     $database['prefix'] = $db_prefix;
     $target = __CLASS__ . $db_prefix;
@@ -316,7 +316,7 @@ protected function addTestDatabase($db_prefix) {
    * @return string
    *   The lock file path.
    */
-  protected function getTestLockFile($db_prefix) {
+  protected function getTestLockFile($db_prefix): string {
     $lock_id = str_replace('test', '', $db_prefix);
     return FileSystem::getOsTemporaryDirectory() . '/test_' . $lock_id;
   }
diff --git a/core/tests/Drupal/Tests/TestRequirementsTrait.php b/core/tests/Drupal/Tests/TestRequirementsTrait.php
index 9cded2ee8755fc87f5ab8dbe27f0d827addbc990..cb177f2da62d94ca65db36d3c01a09d20b179215 100644
--- a/core/tests/Drupal/Tests/TestRequirementsTrait.php
+++ b/core/tests/Drupal/Tests/TestRequirementsTrait.php
@@ -22,7 +22,7 @@ trait TestRequirementsTrait {
    *
    * @return string
    */
-  protected static function getDrupalRoot() {
+  protected static function getDrupalRoot(): string {
     return dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)), 2);
   }
 
diff --git a/core/tests/Drupal/Tests/UiHelperTrait.php b/core/tests/Drupal/Tests/UiHelperTrait.php
index 5e6e9176b10064ae5ec73a69724819f1f169744a..fb96e5034fcf3ad3dbc8307f21bca084e78b7ba3 100644
--- a/core/tests/Drupal/Tests/UiHelperTrait.php
+++ b/core/tests/Drupal/Tests/UiHelperTrait.php
@@ -511,7 +511,7 @@ protected function cssSelect($selector) {
    * @return string
    *   The equivalent XPath of a CSS expression.
    */
-  protected function cssSelectToXpath($selector, $html = TRUE, $prefix = 'descendant-or-self::') {
+  protected function cssSelectToXpath($selector, $html = TRUE, $prefix = 'descendant-or-self::'): string {
     return (new CssSelectorConverter($html))->toXPath($selector, $prefix);
   }