From a9dae8af9e93c695466d616b8f42938de097da12 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Sun, 19 Jun 2022 18:13:29 +0100
Subject: [PATCH] Issue #3283794 by mondrake, longwave: Fix 'should return
 {type} but return statement is missing' PHPStan L0 errors in test code

(cherry picked from commit 9b485ec74db2dfe7c469a9990a7a6e5fe3658e11)
---
 .../Functional/Rest/BlockResourceTestBase.php |  1 +
 .../Rest/BlockContentTypeResourceTestBase.php |  1 +
 .../src/Functional/CommentNonNodeTest.php     |  4 +-
 .../Rest/CommentResourceTestBase.php          |  7 +--
 .../Rest/CommentTypeResourceTestBase.php      |  1 +
 .../Rest/ConfigTestResourceTestBase.php       |  1 +
 .../Rest/ContactFormResourceTestBase.php      |  1 +
 .../Rest/EditorResourceTestBase.php           |  1 +
 .../Rest/FieldConfigResourceTestBase.php      |  1 +
 .../FieldStorageConfigResourceTestBase.php    |  1 +
 .../Rest/FilterFormatResourceTestBase.php     |  1 +
 .../Rest/ImageStyleResourceTestBase.php       |  1 +
 .../tests/src/Functional/ActionTest.php       |  1 +
 .../src/Functional/BaseFieldOverrideTest.php  |  1 +
 .../src/Functional/BlockContentTypeTest.php   |  1 +
 .../tests/src/Functional/BlockTest.php        |  1 +
 .../tests/src/Functional/CommentTypeTest.php  |  1 +
 .../tests/src/Functional/ConfigTestTest.php   |  1 +
 .../Functional/ConfigurableLanguageTest.php   |  1 +
 .../tests/src/Functional/ContactFormTest.php  |  1 +
 .../ContentLanguageSettingsTest.php           |  1 +
 .../tests/src/Functional/DateFormatTest.php   |  1 +
 .../tests/src/Functional/EditorTest.php       |  1 +
 .../src/Functional/EntityFormDisplayTest.php  |  1 +
 .../src/Functional/EntityFormModeTest.php     |  1 +
 .../src/Functional/EntityViewDisplayTest.php  |  1 +
 .../src/Functional/EntityViewModeTest.php     |  1 +
 .../tests/src/Functional/FieldConfigTest.php  |  1 +
 .../src/Functional/FieldStorageConfigTest.php |  1 +
 .../tests/src/Functional/FileUploadTest.php   |  3 ++
 .../tests/src/Functional/FilterFormatTest.php |  1 +
 .../tests/src/Functional/ImageStyleTest.php   |  1 +
 .../tests/src/Functional/MediaTypeTest.php    |  1 +
 .../jsonapi/tests/src/Functional/MenuTest.php |  1 +
 .../jsonapi/tests/src/Functional/NodeTest.php |  1 +
 .../tests/src/Functional/NodeTypeTest.php     |  1 +
 .../tests/src/Functional/RdfMappingTest.php   |  1 +
 .../Functional/ResponsiveImageStyleTest.php   |  1 +
 .../src/Functional/RestJsonApiUnsupported.php |  9 +++-
 .../src/Functional/RestResourceConfigTest.php |  1 +
 .../jsonapi/tests/src/Functional/RoleTest.php |  1 +
 .../tests/src/Functional/SearchPageTest.php   |  1 +
 .../tests/src/Functional/ShortcutSetTest.php  |  1 +
 .../jsonapi/tests/src/Functional/TourTest.php |  1 +
 .../jsonapi/tests/src/Functional/ViewTest.php |  1 +
 .../tests/src/Functional/VocabularyTest.php   |  1 +
 .../tests/src/Functional/WorkflowTest.php     |  1 +
 .../ConfigurableLanguageResourceTestBase.php  |  1 +
 ...ontentLanguageSettingsResourceTestBase.php |  1 +
 .../TestStateBasedSectionStorage.php          | 43 ++++++++++++++-----
 .../Functional/Rest/LayoutRestTestBase.php    |  5 ++-
 .../Rest/MediaTypeResourceTestBase.php        |  1 +
 .../migrate/tests/src/Kernel/SqlBaseTest.php  |  8 +++-
 .../migrate/tests/src/Unit/SqlBaseTest.php    |  8 +++-
 .../tests/src/Unit/TestMigrateExecutable.php  |  1 +
 .../src/Unit/source/DrupalSqlBaseTest.php     |  1 +
 .../src/Functional/d6/IdConflictTest.php      |  4 ++
 .../src/Functional/d6/NodeClassicTest.php     |  4 ++
 .../tests/src/Functional/d7/FilePathTest.php  |  5 +++
 .../src/Functional/d7/IdConflictTest.php      |  4 ++
 .../Rest/NodeTypeResourceTestBase.php         |  1 +
 .../Rest/RdfMappingResourceTestBase.php       |  1 +
 .../ResponsiveImageStyleResourceTestBase.php  |  1 +
 .../Functional/FileUploadResourceTestBase.php |  2 +
 .../tests/src/Functional/ResourceTestBase.php |  2 +
 .../RestResourceConfigResourceTestBase.php    |  1 +
 .../Rest/SearchPageResourceTestBase.php       |  1 +
 .../Rest/ShortcutSetResourceTestBase.php      |  1 +
 .../Rest/EntityTestBundleResourceTestBase.php |  1 +
 .../tests/src/Functional/Form/StubForm.php    |  2 +-
 .../Rest/ActionResourceTestBase.php           |  1 +
 .../Functional/Rest/MenuResourceTestBase.php  |  1 +
 .../PathBasedBreadcrumbBuilderTest.php        |  1 +
 .../Rest/VocabularyResourceTestBase.php       |  1 +
 .../Functional/Rest/TourResourceTestBase.php  |  1 +
 .../Functional/Rest/RoleResourceTestBase.php  |  1 +
 .../Functional/UserRegistrationRestTest.php   |  9 +++-
 .../src/Tests/ViewResultAssertionTrait.php    | 23 +++-------
 .../Functional/Rest/ViewResourceTestBase.php  |  1 +
 .../Rest/WorkflowResourceTestBase.php         |  1 +
 .../BaseFieldOverrideResourceTestBase.php     |  1 +
 .../Rest/DateFormatResourceTestBase.php       |  1 +
 .../EntityFormDisplayResourceTestBase.php     |  1 +
 .../Rest/EntityFormModeResourceTestBase.php   |  1 +
 .../EntityViewDisplayResourceTestBase.php     |  1 +
 .../Rest/EntityViewModeResourceTestBase.php   |  1 +
 .../Drupal/KernelTests/AssertContentTrait.php | 39 ++++-------------
 .../Core/Entity/EntityResolverManagerTest.php |  6 +++
 .../Tests/Core/Entity/FieldDefinitionTest.php |  1 +
 .../Drupal/Tests/Core/Form/FormStateTest.php  |  4 +-
 .../Drupal/Tests/Core/Image/ImageTest.php     |  4 ++
 .../Plugin/LazyPluginCollectionTestBase.php   |  4 +-
 92 files changed, 192 insertions(+), 77 deletions(-)

diff --git a/core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php b/core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php
index dd0e131391d3..47ef41b446eb 100644
--- a/core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php
+++ b/core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php
@@ -109,6 +109,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/block_content/tests/src/Functional/Rest/BlockContentTypeResourceTestBase.php b/core/modules/block_content/tests/src/Functional/Rest/BlockContentTypeResourceTestBase.php
index 7592a1368a6b..f41577634d25 100644
--- a/core/modules/block_content/tests/src/Functional/Rest/BlockContentTypeResourceTestBase.php
+++ b/core/modules/block_content/tests/src/Functional/Rest/BlockContentTypeResourceTestBase.php
@@ -66,6 +66,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
index 106e832b45e5..9820d2553405 100644
--- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
@@ -179,9 +179,7 @@ public function postComment(EntityInterface $entity, $comment, $subject = '', $c
       $this->assertArrayHasKey(1, $match);
     }
 
-    if (isset($match[1])) {
-      return Comment::load($match[1]);
-    }
+    return Comment::load($match[1]);
   }
 
   /**
diff --git a/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php b/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
index aef51880de88..67c3bd12dd54 100644
--- a/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
+++ b/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
@@ -317,16 +317,17 @@ public function testPostDxWithoutCriticalBaseFields() {
    */
   protected function getExpectedUnauthorizedAccessMessage($method) {
     switch ($method) {
-      case 'GET';
+      case 'GET':
         return "The 'access comments' permission is required and the comment must be published.";
 
-      case 'POST';
+      case 'POST':
         return "The 'post comments' permission is required.";
 
-      case 'PATCH';
+      case 'PATCH':
         return "The 'edit own comments' permission is required, the user must be the comment author, and the comment must be published.";
 
       case 'DELETE':
+      default:
         // \Drupal\comment\CommentAccessControlHandler::checkAccess() does not
         // specify a reason for not allowing a comment to be deleted.
         return '';
diff --git a/core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php b/core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php
index b3479156d420..7862f0cec0b1 100644
--- a/core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php
+++ b/core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php
@@ -72,6 +72,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/config/tests/config_test/tests/src/Functional/Rest/ConfigTestResourceTestBase.php b/core/modules/config/tests/config_test/tests/src/Functional/Rest/ConfigTestResourceTestBase.php
index ef9a7701a9fd..8f9751993383 100644
--- a/core/modules/config/tests/config_test/tests/src/Functional/Rest/ConfigTestResourceTestBase.php
+++ b/core/modules/config/tests/config_test/tests/src/Functional/Rest/ConfigTestResourceTestBase.php
@@ -68,6 +68,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/contact/tests/src/Functional/Rest/ContactFormResourceTestBase.php b/core/modules/contact/tests/src/Functional/Rest/ContactFormResourceTestBase.php
index 43d4ec5bd157..ea30b9012510 100644
--- a/core/modules/contact/tests/src/Functional/Rest/ContactFormResourceTestBase.php
+++ b/core/modules/contact/tests/src/Functional/Rest/ContactFormResourceTestBase.php
@@ -85,6 +85,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/editor/tests/src/Functional/Rest/EditorResourceTestBase.php b/core/modules/editor/tests/src/Functional/Rest/EditorResourceTestBase.php
index dc40d05b4618..2612c7215ffb 100644
--- a/core/modules/editor/tests/src/Functional/Rest/EditorResourceTestBase.php
+++ b/core/modules/editor/tests/src/Functional/Rest/EditorResourceTestBase.php
@@ -122,6 +122,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/field/tests/src/Functional/Rest/FieldConfigResourceTestBase.php b/core/modules/field/tests/src/Functional/Rest/FieldConfigResourceTestBase.php
index 7728cd2c7226..025b820df175 100644
--- a/core/modules/field/tests/src/Functional/Rest/FieldConfigResourceTestBase.php
+++ b/core/modules/field/tests/src/Functional/Rest/FieldConfigResourceTestBase.php
@@ -94,6 +94,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/field/tests/src/Functional/Rest/FieldStorageConfigResourceTestBase.php b/core/modules/field/tests/src/Functional/Rest/FieldStorageConfigResourceTestBase.php
index fed650e093b3..c623edb5a728 100644
--- a/core/modules/field/tests/src/Functional/Rest/FieldStorageConfigResourceTestBase.php
+++ b/core/modules/field/tests/src/Functional/Rest/FieldStorageConfigResourceTestBase.php
@@ -73,6 +73,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/filter/tests/src/Functional/Rest/FilterFormatResourceTestBase.php b/core/modules/filter/tests/src/Functional/Rest/FilterFormatResourceTestBase.php
index 611dca559e0d..95db23e65adc 100644
--- a/core/modules/filter/tests/src/Functional/Rest/FilterFormatResourceTestBase.php
+++ b/core/modules/filter/tests/src/Functional/Rest/FilterFormatResourceTestBase.php
@@ -83,6 +83,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/image/tests/src/Functional/Rest/ImageStyleResourceTestBase.php b/core/modules/image/tests/src/Functional/Rest/ImageStyleResourceTestBase.php
index ec348d0a807f..fdad4a2e9b6c 100644
--- a/core/modules/image/tests/src/Functional/Rest/ImageStyleResourceTestBase.php
+++ b/core/modules/image/tests/src/Functional/Rest/ImageStyleResourceTestBase.php
@@ -99,6 +99,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/ActionTest.php b/core/modules/jsonapi/tests/src/Functional/ActionTest.php
index 1495e9aaca19..ba0b527c4c17 100644
--- a/core/modules/jsonapi/tests/src/Functional/ActionTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ActionTest.php
@@ -112,6 +112,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php b/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
index 756db12545e1..083603090ae2 100644
--- a/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
@@ -123,6 +123,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php b/core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php
index 8db3069331fa..77aa86470ee5 100644
--- a/core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php
@@ -103,6 +103,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/BlockTest.php b/core/modules/jsonapi/tests/src/Functional/BlockTest.php
index 16c5213f3d4e..41911a900c3d 100644
--- a/core/modules/jsonapi/tests/src/Functional/BlockTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/BlockTest.php
@@ -136,6 +136,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update once https://www.drupal.org/node/2300677 is fixed.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/CommentTypeTest.php b/core/modules/jsonapi/tests/src/Functional/CommentTypeTest.php
index 1179c8112257..e3654b49e9d2 100644
--- a/core/modules/jsonapi/tests/src/Functional/CommentTypeTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/CommentTypeTest.php
@@ -104,6 +104,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/ConfigTestTest.php b/core/modules/jsonapi/tests/src/Functional/ConfigTestTest.php
index c4dc049eef07..df19a11b85f7 100644
--- a/core/modules/jsonapi/tests/src/Functional/ConfigTestTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ConfigTestTest.php
@@ -116,6 +116,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php b/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
index 97dd34593bdc..ad2c26177992 100644
--- a/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
@@ -105,6 +105,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php b/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
index 1e90a94fcb73..b91d4b7d5acb 100644
--- a/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
@@ -112,6 +112,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php b/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php
index e80d50fc5ff8..608254907627 100644
--- a/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php
@@ -116,6 +116,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/DateFormatTest.php b/core/modules/jsonapi/tests/src/Functional/DateFormatTest.php
index 4381a24ffc35..42e673c526b7 100644
--- a/core/modules/jsonapi/tests/src/Functional/DateFormatTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/DateFormatTest.php
@@ -108,6 +108,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/EditorTest.php b/core/modules/jsonapi/tests/src/Functional/EditorTest.php
index b1c4a8afff37..8dc45e7e784b 100644
--- a/core/modules/jsonapi/tests/src/Functional/EditorTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EditorTest.php
@@ -156,6 +156,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php b/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php
index 2cbe0d412432..b4162427f706 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php
@@ -173,6 +173,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/EntityFormModeTest.php b/core/modules/jsonapi/tests/src/Functional/EntityFormModeTest.php
index 5e012df6221f..91804ab36490 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntityFormModeTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntityFormModeTest.php
@@ -106,6 +106,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php b/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php
index 89aade958ee1..6a96388a8f13 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php
@@ -127,6 +127,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/EntityViewModeTest.php b/core/modules/jsonapi/tests/src/Functional/EntityViewModeTest.php
index e33fc3a9d583..27bf64d45c21 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntityViewModeTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntityViewModeTest.php
@@ -106,6 +106,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php b/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php
index 88a78698ba06..eb81f50912dc 100644
--- a/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php
@@ -133,6 +133,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php b/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php
index 0a788410438b..d7f770803aec 100644
--- a/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php
@@ -112,6 +112,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
index 16ed1621a759..0dcfb3e68d4e 100644
--- a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
@@ -5,6 +5,7 @@
 use Drupal\Component\Render\PlainTextOutput;
 use Drupal\Component\Serialization\Json;
 use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Url;
 use Drupal\entity_test\Entity\EntityTest;
@@ -775,6 +776,7 @@ protected function getExpectedUnauthorizedAccessMessage($method) {
       case 'PATCH':
         return "The current user is not permitted to upload a file for this field. The 'administer entity_test content' permission is required.";
     }
+    return '';
   }
 
   /**
@@ -927,6 +929,7 @@ protected function assertResponseData(array $expected, ResponseInterface $respon
   protected function getExpectedUnauthorizedAccessCacheability() {
     // There is cacheability metadata to check as file uploads only allows POST
     // requests, which will not return cacheable responses.
+    return new CacheableMetadata();
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/FilterFormatTest.php b/core/modules/jsonapi/tests/src/Functional/FilterFormatTest.php
index 66cb157c3c7e..c40e249d6880 100644
--- a/core/modules/jsonapi/tests/src/Functional/FilterFormatTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/FilterFormatTest.php
@@ -120,6 +120,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php b/core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php
index 4180a6ef21cb..1bafcf55bd76 100644
--- a/core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php
@@ -130,6 +130,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php b/core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php
index 5e02fa47fda9..cd26f4af3d0d 100644
--- a/core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php
@@ -110,6 +110,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/MenuTest.php b/core/modules/jsonapi/tests/src/Functional/MenuTest.php
index fb22eecee5c0..c367ab617959 100644
--- a/core/modules/jsonapi/tests/src/Functional/MenuTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/MenuTest.php
@@ -106,6 +106,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/NodeTest.php b/core/modules/jsonapi/tests/src/Functional/NodeTest.php
index 6e3d99a76236..ec45b2d0b4ef 100644
--- a/core/modules/jsonapi/tests/src/Functional/NodeTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/NodeTest.php
@@ -265,6 +265,7 @@ protected function getExpectedUnauthorizedAccessMessage($method) {
       case 'DELETE':
         return "The 'access content' permission is required.";
     }
+    return '';
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php b/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php
index 42890aa208e3..ea93316bbd12 100644
--- a/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php
@@ -106,6 +106,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/RdfMappingTest.php b/core/modules/jsonapi/tests/src/Functional/RdfMappingTest.php
index f820095ff26a..61e0f378ee1e 100644
--- a/core/modules/jsonapi/tests/src/Functional/RdfMappingTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/RdfMappingTest.php
@@ -148,6 +148,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/ResponsiveImageStyleTest.php b/core/modules/jsonapi/tests/src/Functional/ResponsiveImageStyleTest.php
index 86e4c3848020..32b14bd96112 100644
--- a/core/modules/jsonapi/tests/src/Functional/ResponsiveImageStyleTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ResponsiveImageStyleTest.php
@@ -142,6 +142,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
index d58bc02b2f70..afabfeefb991 100644
--- a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
+++ b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\jsonapi\Functional;
 
+use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Url;
 use Drupal\node\Entity\Node;
 use Drupal\node\Entity\NodeType;
@@ -117,11 +118,15 @@ protected function assertNormalizationEdgeCases($method, Url $url, array $reques
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {}
+  protected function getExpectedUnauthorizedAccessMessage($method) {
+    return '';
+  }
 
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessCacheability() {}
+  protected function getExpectedUnauthorizedAccessCacheability() {
+    return (new CacheableMetadata());
+  }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php b/core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
index c900db5a903e..5dbeeff934ef 100644
--- a/core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
@@ -126,6 +126,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/RoleTest.php b/core/modules/jsonapi/tests/src/Functional/RoleTest.php
index e82b53e9f4fd..a5116132252b 100644
--- a/core/modules/jsonapi/tests/src/Functional/RoleTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/RoleTest.php
@@ -101,6 +101,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/SearchPageTest.php b/core/modules/jsonapi/tests/src/Functional/SearchPageTest.php
index fc4ffaa49be4..ea1e4a00871c 100644
--- a/core/modules/jsonapi/tests/src/Functional/SearchPageTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/SearchPageTest.php
@@ -119,6 +119,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/ShortcutSetTest.php b/core/modules/jsonapi/tests/src/Functional/ShortcutSetTest.php
index a5e080b8d2a9..657cd1c3c9ee 100644
--- a/core/modules/jsonapi/tests/src/Functional/ShortcutSetTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ShortcutSetTest.php
@@ -123,6 +123,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/TourTest.php b/core/modules/jsonapi/tests/src/Functional/TourTest.php
index 9a3a1d24270a..138616099022 100644
--- a/core/modules/jsonapi/tests/src/Functional/TourTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/TourTest.php
@@ -131,6 +131,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/ViewTest.php b/core/modules/jsonapi/tests/src/Functional/ViewTest.php
index a94c3c7194e5..a4c105aae9f2 100644
--- a/core/modules/jsonapi/tests/src/Functional/ViewTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/ViewTest.php
@@ -121,6 +121,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/VocabularyTest.php b/core/modules/jsonapi/tests/src/Functional/VocabularyTest.php
index 49e548dcf163..cf86bb3e77b0 100644
--- a/core/modules/jsonapi/tests/src/Functional/VocabularyTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/VocabularyTest.php
@@ -100,6 +100,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/WorkflowTest.php b/core/modules/jsonapi/tests/src/Functional/WorkflowTest.php
index 94cda92d29e1..7a2a00a8e03d 100644
--- a/core/modules/jsonapi/tests/src/Functional/WorkflowTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/WorkflowTest.php
@@ -126,6 +126,7 @@ protected function getExpectedDocument() {
    */
   protected function getPostDocument() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/language/tests/src/Functional/Rest/ConfigurableLanguageResourceTestBase.php b/core/modules/language/tests/src/Functional/Rest/ConfigurableLanguageResourceTestBase.php
index 933202a12225..02a976c7406a 100644
--- a/core/modules/language/tests/src/Functional/Rest/ConfigurableLanguageResourceTestBase.php
+++ b/core/modules/language/tests/src/Functional/Rest/ConfigurableLanguageResourceTestBase.php
@@ -73,6 +73,7 @@ protected function getExpectedCacheContexts() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php b/core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php
index 3eafb0be0744..30683f0a14a6 100644
--- a/core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php
+++ b/core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php
@@ -77,6 +77,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
index d51cdc72c09d..378975db6b30 100644
--- a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
+++ b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
@@ -43,56 +43,77 @@ public function isApplicable(RefinableCacheableDependencyInterface $cacheability
   /**
    * {@inheritdoc}
    */
-  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {}
+  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  protected function getSectionList() {}
+  protected function getSectionList() {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function getStorageId() {}
+  public function getStorageId() {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function getSectionListFromId($id) {}
+  public function getSectionListFromId($id) {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function buildRoutes(RouteCollection $collection) {}
+  public function buildRoutes(RouteCollection $collection) {
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function getRedirectUrl() {}
+  public function getRedirectUrl() {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function getLayoutBuilderUrl($rel = 'view') {}
+  public function getLayoutBuilderUrl($rel = 'view') {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function extractIdFromRoute($value, $definition, $name, array $defaults) {}
+  public function extractIdFromRoute($value, $definition, $name, array $defaults) {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function deriveContextsFromRoute($value, $definition, $name, array $defaults) {}
+  public function deriveContextsFromRoute($value, $definition, $name, array $defaults) {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function label() {}
+  public function label() {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function save() {}
+  public function save() {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
 }
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..071dc05065f4 100644
--- a/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php
+++ b/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\layout_builder\Functional\Rest;
 
 use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Url;
 use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
 use Drupal\Tests\rest\Functional\ResourceTestBase;
@@ -131,7 +132,9 @@ protected function assertAuthenticationEdgeCases($method, Url $url, array $reque
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessCacheability() {}
+  protected function getExpectedUnauthorizedAccessCacheability() {
+    return (new CacheableMetadata());
+  }
 
   /**
    * Gets the decoded contents.
diff --git a/core/modules/media/tests/src/Functional/Rest/MediaTypeResourceTestBase.php b/core/modules/media/tests/src/Functional/Rest/MediaTypeResourceTestBase.php
index c935962fb5cf..c74909e6f1ab 100644
--- a/core/modules/media/tests/src/Functional/Rest/MediaTypeResourceTestBase.php
+++ b/core/modules/media/tests/src/Functional/Rest/MediaTypeResourceTestBase.php
@@ -73,6 +73,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php b/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php
index 71eaef1a4e66..1661aece762f 100644
--- a/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php
+++ b/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php
@@ -225,12 +225,16 @@ public function setConfiguration($config) {
   /**
    * {@inheritdoc}
    */
-  public function getIds() {}
+  public function getIds() {
+    return [];
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function fields() {}
+  public function fields() {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/migrate/tests/src/Unit/SqlBaseTest.php b/core/modules/migrate/tests/src/Unit/SqlBaseTest.php
index aa843c4ea289..749d9937f04b 100644
--- a/core/modules/migrate/tests/src/Unit/SqlBaseTest.php
+++ b/core/modules/migrate/tests/src/Unit/SqlBaseTest.php
@@ -220,12 +220,16 @@ public function setIds($ids) {
   /**
    * {@inheritdoc}
    */
-  public function fields() {}
+  public function fields() {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function query() {}
+  public function query() {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+  }
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php b/core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php
index 312472d7341c..ecd56ca9c844 100644
--- a/core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php
+++ b/core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php
@@ -32,6 +32,7 @@ class TestMigrateExecutable extends MigrateExecutable {
    */
   public function setStringTranslation(TranslationInterface $string_translation) {
     $this->stringTranslation = $string_translation;
+    return $this;
   }
 
   /**
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..a4ed2628eea5 100644
--- a/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
+++ b/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
@@ -184,6 +184,7 @@ public function fields() {
    * {@inheritdoc}
    */
   public function query() {
+    throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
   }
 
   /**
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 7e9412f25d9b..e03d0f7f39e7 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
@@ -44,24 +44,28 @@ protected function getSourceBasePath() {
    * {@inheritdoc}
    */
   protected function getEntityCounts() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getEntityCountsIncremental() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getAvailablePaths() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getMissingPaths() {
+    return [];
   }
 
   /**
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 6cea7ef5a44e..723659894640 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
@@ -51,24 +51,28 @@ protected function getSourceBasePath() {
    * {@inheritdoc}
    */
   protected function getEntityCounts() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getEntityCountsIncremental() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getAvailablePaths() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getMissingPaths() {
+    return [];
   }
 
   /**
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 5f8652e8d20c..6ccb1f97ff0c 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
@@ -287,30 +287,35 @@ public function getManagedFiles() {
    * {@inheritdoc}
    */
   protected function getEntityCounts() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getEntityCountsIncremental() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getAvailablePaths() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getMissingPaths() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getSourceBasePath() {
+    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 961e24dcfc3d..892e4df6c29b 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
@@ -44,24 +44,28 @@ protected function getSourceBasePath() {
    * {@inheritdoc}
    */
   protected function getEntityCounts() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getEntityCountsIncremental() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getAvailablePaths() {
+    return [];
   }
 
   /**
    * {@inheritdoc}
    */
   protected function getMissingPaths() {
+    return [];
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/Rest/NodeTypeResourceTestBase.php b/core/modules/node/tests/src/Functional/Rest/NodeTypeResourceTestBase.php
index b65a2b0433a8..9b3e21cc8628 100644
--- a/core/modules/node/tests/src/Functional/Rest/NodeTypeResourceTestBase.php
+++ b/core/modules/node/tests/src/Functional/Rest/NodeTypeResourceTestBase.php
@@ -74,6 +74,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php b/core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php
index 45d3b3ef4029..3a7e26bd341a 100644
--- a/core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php
+++ b/core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php
@@ -111,6 +111,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/responsive_image/tests/src/Functional/Rest/ResponsiveImageStyleResourceTestBase.php b/core/modules/responsive_image/tests/src/Functional/Rest/ResponsiveImageStyleResourceTestBase.php
index 1e115fd8bc14..7b0c7f0752a0 100644
--- a/core/modules/responsive_image/tests/src/Functional/Rest/ResponsiveImageStyleResourceTestBase.php
+++ b/core/modules/responsive_image/tests/src/Functional/Rest/ResponsiveImageStyleResourceTestBase.php
@@ -117,6 +117,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php b/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
index c5381d5cdcdb..d95f4cd97cc9 100644
--- a/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
@@ -4,6 +4,7 @@
 
 use Drupal\Component\Render\PlainTextOutput;
 use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Url;
 use Drupal\entity_test\Entity\EntityTest;
@@ -819,6 +820,7 @@ protected function assertResponseData(array $expected, ResponseInterface $respon
   protected function getExpectedUnauthorizedAccessCacheability() {
     // There is cacheability metadata to check as file uploads only allows POST
     // requests, which will not return cacheable responses.
+    return new CacheableMetadata();
   }
 
 }
diff --git a/core/modules/rest/tests/src/Functional/ResourceTestBase.php b/core/modules/rest/tests/src/Functional/ResourceTestBase.php
index ce509970d545..575bf976dcba 100644
--- a/core/modules/rest/tests/src/Functional/ResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/ResourceTestBase.php
@@ -501,6 +501,8 @@ protected static function recursiveKSort(array &$array) {
         static::recursiveKSort($value);
       }
     }
+
+    return $array;
   }
 
 }
diff --git a/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php b/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php
index 45e94739509e..f63cd257da20 100644
--- a/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php
@@ -89,6 +89,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/search/tests/src/Functional/Rest/SearchPageResourceTestBase.php b/core/modules/search/tests/src/Functional/Rest/SearchPageResourceTestBase.php
index b9f00855a726..5555e0211d04 100644
--- a/core/modules/search/tests/src/Functional/Rest/SearchPageResourceTestBase.php
+++ b/core/modules/search/tests/src/Functional/Rest/SearchPageResourceTestBase.php
@@ -80,6 +80,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php b/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php
index e019984eb3ed..5efce2740a0d 100644
--- a/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php
+++ b/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php
@@ -83,6 +83,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestBundleResourceTestBase.php b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestBundleResourceTestBase.php
index 26ed9224573d..87ff2589940d 100644
--- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestBundleResourceTestBase.php
+++ b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestBundleResourceTestBase.php
@@ -68,6 +68,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Form/StubForm.php b/core/modules/system/tests/src/Functional/Form/StubForm.php
index 9e20c365ba83..4c30673d825f 100644
--- a/core/modules/system/tests/src/Functional/Form/StubForm.php
+++ b/core/modules/system/tests/src/Functional/Form/StubForm.php
@@ -43,7 +43,7 @@ public function __construct($form_id, $form) {
    * {@inheritdoc}
    */
   public function getFormId() {
-    $this->formId;
+    return $this->formId;
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php b/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php
index 36a3222a9661..b53be1b7b4f6 100644
--- a/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php
+++ b/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php
@@ -75,6 +75,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php b/core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
index d378086e865b..a30f442648d0 100644
--- a/core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
+++ b/core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
@@ -64,6 +64,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
index 6a6081f94c1c..d80787e5dedb 100644
--- a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
+++ b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
@@ -415,6 +415,7 @@ class TestPathBasedBreadcrumbBuilder extends PathBasedBreadcrumbBuilder {
 
   public function setStringTranslation(TranslationInterface $string_translation) {
     $this->stringTranslation = $string_translation;
+    return $this;
   }
 
   public function setLinkGenerator(LinkGeneratorInterface $link_generator) {
diff --git a/core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php b/core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php
index 0693daf166a4..de8e7a580407 100644
--- a/core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php
+++ b/core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php
@@ -63,6 +63,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/tour/tests/src/Functional/Rest/TourResourceTestBase.php b/core/modules/tour/tests/src/Functional/Rest/TourResourceTestBase.php
index 40bfced3dd6c..813505a304ed 100644
--- a/core/modules/tour/tests/src/Functional/Rest/TourResourceTestBase.php
+++ b/core/modules/tour/tests/src/Functional/Rest/TourResourceTestBase.php
@@ -94,6 +94,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/Rest/RoleResourceTestBase.php b/core/modules/user/tests/src/Functional/Rest/RoleResourceTestBase.php
index bb090a103e85..0c12f123ce55 100644
--- a/core/modules/user/tests/src/Functional/Rest/RoleResourceTestBase.php
+++ b/core/modules/user/tests/src/Functional/Rest/RoleResourceTestBase.php
@@ -64,6 +64,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php b/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
index c09aa289ee84..401afc3a3a17 100644
--- a/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
+++ b/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\user\Functional;
 
+use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Test\AssertMailTrait;
 use Drupal\Core\Url;
 use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
@@ -248,11 +249,15 @@ protected function assertNormalizationEdgeCases($method, Url $url, array $reques
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessMessage($method) {}
+  protected function getExpectedUnauthorizedAccessMessage($method) {
+    return '';
+  }
 
   /**
    * {@inheritdoc}
    */
-  protected function getExpectedUnauthorizedAccessCacheability() {}
+  protected function getExpectedUnauthorizedAccessCacheability() {
+    return new CacheableMetadata();
+  }
 
 }
diff --git a/core/modules/views/src/Tests/ViewResultAssertionTrait.php b/core/modules/views/src/Tests/ViewResultAssertionTrait.php
index 09a373d406ef..a98c18e64717 100644
--- a/core/modules/views/src/Tests/ViewResultAssertionTrait.php
+++ b/core/modules/views/src/Tests/ViewResultAssertionTrait.php
@@ -27,12 +27,9 @@ trait ViewResultAssertionTrait {
    * @param string $message
    *   (optional) A custom message to display with the assertion. Defaults to
    *   'Identical result set.'
-   *
-   * @return bool
-   *   TRUE if the assertion succeeded, or FALSE otherwise.
    */
-  protected function assertIdenticalResultset($view, $expected_result, $column_map = [], $message = NULL) {
-    return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertIdentical', $message);
+  protected function assertIdenticalResultset($view, $expected_result, $column_map = [], $message = NULL): void {
+    $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertIdentical', $message);
   }
 
   /**
@@ -50,12 +47,9 @@ protected function assertIdenticalResultset($view, $expected_result, $column_map
    * @param string $message
    *   (optional) A custom message to display with the assertion. Defaults to
    *   'Non-identical result set.'
-   *
-   * @return bool
-   *   TRUE if the assertion succeeded, or FALSE otherwise.
    */
-  protected function assertNotIdenticalResultset($view, $expected_result, $column_map = [], $message = NULL) {
-    return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertNotIdentical', $message);
+  protected function assertNotIdenticalResultset($view, $expected_result, $column_map = [], $message = NULL): void {
+    $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertNotIdentical', $message);
   }
 
   /**
@@ -76,11 +70,8 @@ protected function assertNotIdenticalResultset($view, $expected_result, $column_
    *   'assertNotIdentical').
    * @param string $message
    *   (optional) The message to display with the assertion.
-   *
-   * @return bool
-   *   TRUE if the assertion succeeded.
    */
-  protected function assertIdenticalResultsetHelper($view, $expected_result, $column_map, $assert_method, $message = NULL) {
+  protected function assertIdenticalResultsetHelper($view, $expected_result, $column_map, $assert_method, $message = NULL): void {
     // Convert $view->result to an array of arrays.
     $result = [];
     foreach ($view->result as $key => $value) {
@@ -142,11 +133,11 @@ protected function assertIdenticalResultsetHelper($view, $expected_result, $colu
     switch ($assert_method) {
       case 'assertIdentical':
         $this->assertSame($expected_result, $result, $message);
-        return TRUE;
+        break;
 
       case 'assertNotIdentical':
         $this->assertNotSame($expected_result, $result, $message);
-        return TRUE;
+        break;
 
     }
   }
diff --git a/core/modules/views/tests/src/Functional/Rest/ViewResourceTestBase.php b/core/modules/views/tests/src/Functional/Rest/ViewResourceTestBase.php
index 6c5c5d9376a9..27ae62269018 100644
--- a/core/modules/views/tests/src/Functional/Rest/ViewResourceTestBase.php
+++ b/core/modules/views/tests/src/Functional/Rest/ViewResourceTestBase.php
@@ -84,6 +84,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php b/core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php
index a9317f1e1f8f..a192a419d91c 100644
--- a/core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php
+++ b/core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php
@@ -102,6 +102,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideResourceTestBase.php b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideResourceTestBase.php
index 8e729b90fc80..4bd2f5aa1b6c 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideResourceTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideResourceTestBase.php
@@ -86,6 +86,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php b/core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php
index 73fb238d2f21..0ae1c2fb3c41 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php
@@ -71,6 +71,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayResourceTestBase.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayResourceTestBase.php
index 44f2e6ab22a1..65c925320e23 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayResourceTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayResourceTestBase.php
@@ -137,6 +137,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeResourceTestBase.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeResourceTestBase.php
index cb367bcde733..93d734a7d8e1 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeResourceTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeResourceTestBase.php
@@ -69,6 +69,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php
index cea9928f5344..51e1f2a8eba9 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php
@@ -95,6 +95,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
   /**
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php
index 35777e02c74b..86876e5b6f4e 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php
@@ -69,6 +69,7 @@ protected function getExpectedNormalizedEntity() {
    */
   protected function getNormalizedPostEntity() {
     // @todo Update in https://www.drupal.org/node/2300677.
+    return [];
   }
 
 }
diff --git a/core/tests/Drupal/KernelTests/AssertContentTrait.php b/core/tests/Drupal/KernelTests/AssertContentTrait.php
index f8a99a0ce477..162704778359 100644
--- a/core/tests/Drupal/KernelTests/AssertContentTrait.php
+++ b/core/tests/Drupal/KernelTests/AssertContentTrait.php
@@ -429,11 +429,8 @@ protected function assertNoLinkByHrefInMainRegion($href, $message = '', $group =
    *   in test output. Use 'Debug' to indicate this is debugging output. Do not
    *   translate this string. Defaults to 'Other'; most tests do not override
    *   this default.
-   *
-   * @return bool
-   *   TRUE on pass, FALSE on fail.
    */
-  protected function assertRaw($raw, $message = '', $group = 'Other') {
+  protected function assertRaw($raw, $message = '', $group = 'Other'): void {
     if (!$message) {
       $message = 'Raw "' . Html::escape($raw) . '" found';
     }
@@ -457,11 +454,8 @@ protected function assertRaw($raw, $message = '', $group = 'Other') {
    *   in test output. Use 'Debug' to indicate this is debugging output. Do not
    *   translate this string. Defaults to 'Other'; most tests do not override
    *   this default.
-   *
-   * @return bool
-   *   TRUE on pass, FALSE on fail.
    */
-  protected function assertNoRaw($raw, $message = '', $group = 'Other') {
+  protected function assertNoRaw($raw, $message = '', $group = 'Other'): void {
     if (!$message) {
       $message = 'Raw "' . Html::escape($raw) . '" not found';
     }
@@ -485,11 +479,8 @@ protected function assertNoRaw($raw, $message = '', $group = 'Other') {
    *   in test output. Use 'Debug' to indicate this is debugging output. Do not
    *   translate this string. Defaults to 'Other'; most tests do not override
    *   this default.
-   *
-   * @return bool
-   *   TRUE on pass, FALSE on fail.
    */
-  protected function assertEscaped($raw, $message = '', $group = 'Other') {
+  protected function assertEscaped($raw, $message = '', $group = 'Other'): void {
     if (!$message) {
       $message = 'Escaped "' . Html::escape($raw) . '" found';
     }
@@ -514,11 +505,8 @@ protected function assertEscaped($raw, $message = '', $group = 'Other') {
    *   in test output. Use 'Debug' to indicate this is debugging output. Do not
    *   translate this string. Defaults to 'Other'; most tests do not override
    *   this default.
-   *
-   * @return bool
-   *   TRUE on pass, FALSE on fail.
    */
-  protected function assertNoEscaped($raw, $message = '', $group = 'Other') {
+  protected function assertNoEscaped($raw, $message = '', $group = 'Other'): void {
     if (!$message) {
       $message = 'Escaped "' . Html::escape($raw) . '" not found';
     }
@@ -544,13 +532,10 @@ protected function assertNoEscaped($raw, $message = '', $group = 'Other') {
    *   translate this string. Defaults to 'Other'; most tests do not override
    *   this default.
    *
-   * @return bool
-   *   TRUE on pass, FALSE on fail.
-   *
    * @see \Drupal\simpletest\AssertContentTrait::assertRaw()
    */
-  protected function assertText($text, $message = '', $group = 'Other') {
-    return $this->assertTextHelper($text, $message, $group, FALSE);
+  protected function assertText($text, $message = '', $group = 'Other'): void {
+    $this->assertTextHelper($text, $message, $group, FALSE);
   }
 
   /**
@@ -572,13 +557,10 @@ protected function assertText($text, $message = '', $group = 'Other') {
    *   translate this string. Defaults to 'Other'; most tests do not override
    *   this default.
    *
-   * @return bool
-   *   TRUE on pass, FALSE on fail.
-   *
    * @see \Drupal\simpletest\AssertContentTrait::assertNoRaw()
    */
-  protected function assertNoText($text, $message = '', $group = 'Other') {
-    return $this->assertTextHelper($text, $message, $group, TRUE);
+  protected function assertNoText($text, $message = '', $group = 'Other'): void {
+    $this->assertTextHelper($text, $message, $group, TRUE);
   }
 
   /**
@@ -601,11 +583,8 @@ protected function assertNoText($text, $message = '', $group = 'Other') {
    * @param bool $not_exists
    *   (optional) TRUE if this text should not exist, FALSE if it should.
    *   Defaults to TRUE.
-   *
-   * @return bool
-   *   TRUE on pass, FALSE on fail.
    */
-  protected function assertTextHelper($text, $message = '', $group = 'Other', $not_exists = TRUE) {
+  protected function assertTextHelper($text, $message = '', $group = 'Other', $not_exists = TRUE): void {
     if (!$message) {
       $message = !$not_exists ? new FormattableMarkup('"@text" found', ['@text' => $text]) : new FormattableMarkup('"@text" not found', ['@text' => $text]);
     }
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
index 4b66ca8c3948..829d2dfa9a00 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
@@ -515,12 +515,14 @@ class BasicForm extends FormBase {
    * {@inheritdoc}
    */
   public function getFormId() {
+    return '';
   }
 
   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity_test = NULL) {
+    return [];
   }
 
   /**
@@ -540,12 +542,14 @@ class BasicFormNoUpcasting extends FormBase {
    * {@inheritdoc}
    */
   public function getFormId() {
+    return '';
   }
 
   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state, $entity_test = NULL) {
+    return [];
   }
 
   /**
@@ -562,12 +566,14 @@ class BasicFormNoContainerInjectionInterface implements FormInterface {
    * {@inheritdoc}
    */
   public function getFormId() {
+    return '';
   }
 
   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity_test = NULL) {
+    return [];
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
index 7f1e27289de0..a857c6f25348 100644
--- a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
@@ -385,6 +385,7 @@ protected function initializeFieldUsingFactory($factory_name) {
         $definition->setFieldStorageDefinition($this->storageDefinition);
         return $definition;
     }
+    throw new \InvalidArgumentException("Invalid factory name '$factory_name' passed to " . __METHOD__);
   }
 
 }
diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
index 9e8d552e0c3e..e553d887cd95 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
@@ -441,7 +441,9 @@ public function getFormId() {
     return 'test_form';
   }
 
-  public function buildForm(array $form, FormStateInterface $form_state) {}
+  public function buildForm(array $form, FormStateInterface $form_state) {
+    return [];
+  }
 
   public function validateForm(array &$form, FormStateInterface $form_state) {}
 
diff --git a/core/tests/Drupal/Tests/Core/Image/ImageTest.php b/core/tests/Drupal/Tests/Core/Image/ImageTest.php
index b2d963612923..e0a15e2a8260 100644
--- a/core/tests/Drupal/Tests/Core/Image/ImageTest.php
+++ b/core/tests/Drupal/Tests/Core/Image/ImageTest.php
@@ -116,6 +116,8 @@ protected function getTestImage($load_expected = TRUE, array $stubs = []) {
     }
 
     $this->image = new Image($this->toolkit, $this->source);
+
+    return $this->image;
   }
 
   /**
@@ -140,6 +142,8 @@ protected function getTestImageForOperation($class_name) {
       ->will($this->returnValue($this->toolkitOperation));
 
     $this->image = new Image($this->toolkit, $this->source);
+
+    return $this->image;
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php b/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
index 45132288d7cc..1cfdcd01e3ea 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
@@ -86,9 +86,7 @@ protected function setupPluginCollection(InvocationOrder $create_count = NULL) {
    *   The mock plugin object.
    */
   public function returnPluginMap($plugin_id) {
-    if (isset($this->pluginInstances[$plugin_id])) {
-      return $this->pluginInstances[$plugin_id];
-    }
+    return $this->pluginInstances[$plugin_id];
   }
 
   /**
-- 
GitLab