From 2a232304d72b46c8818cd32ff455d876877789c5 Mon Sep 17 00:00:00 2001
From: Lee Rowlands <lee.rowlands@previousnext.com.au>
Date: Mon, 15 Jan 2024 15:23:28 +1000
Subject: [PATCH] Issue #3407793 by mstrelan: Add declare(strict_types=1) to
 all miscellaneous test classes

---
 .../field/tests/src/Functional/NestedFormTest.php   |  2 +-
 .../system/src/Tests/Routing/MockAliasManager.php   |  2 ++
 .../system/src/Tests/Routing/MockRouteProvider.php  |  2 ++
 core/phpcs.xml.dist                                 | 13 +++++++------
 .../TestSite/Commands/TestSiteInstallCommand.php    |  2 ++
 .../Commands/TestSiteReleaseLocksCommand.php        |  2 ++
 .../TestSite/Commands/TestSiteTearDownCommand.php   |  2 ++
 .../TestSite/Commands/TestSiteUserLoginCommand.php  |  2 ++
 .../Drupal/TestSite/TestPreinstallInterface.php     |  2 ++
 core/tests/Drupal/TestSite/TestSetupInterface.php   |  2 ++
 core/tests/Drupal/TestSite/TestSiteApplication.php  |  2 ++
 .../Drupal/TestSite/TestSiteInstallTestScript.php   |  2 ++
 .../TestSiteMultilingualInstallTestScript.php       |  2 ++
 .../TestSite/TestSiteOliveroInstallTestScript.php   |  2 ++
 .../Comparator/MarkupInterfaceComparator.php        |  2 ++
 .../TestTools/Extension/RequiresComposerTrait.php   |  2 ++
 .../Drupal/TestTools/Extension/SchemaInspector.php  |  2 ++
 .../TestTools/PhpUnitCompatibility/ClassWriter.php  |  2 ++
 .../PhpUnit9/TestCompatibilityTrait.php             |  2 ++
 .../PhpUnitCompatibility/RunnerVersion.php          |  2 ++
 core/tests/Drupal/TestTools/Random.php              |  4 +++-
 core/tests/Drupal/TestTools/TestVarDumper.php       |  2 ++
 core/tests/Drupal/Tests/BrowserTestBase.php         |  2 ++
 core/tests/Drupal/Tests/ComposerIntegrationTest.php |  2 ++
 .../modules/module_handler_test/hook_include.inc    |  2 ++
 .../module_handler_test/module_handler_test.module  |  2 ++
 .../module_handler_test_added.hook.inc              |  2 ++
 .../module_handler_test_added.module                |  2 ++
 .../module_handler_test_all1.module                 |  2 ++
 .../module_handler_test_all2.module                 |  2 ++
 .../Tests/Core/Form/fixtures/form_base_test.inc     |  2 ++
 core/tests/Drupal/Tests/DrupalTestBrowser.php       |  2 ++
 core/tests/Drupal/Tests/ExpectDeprecationTest.php   |  2 ++
 core/tests/Drupal/Tests/HiddenFieldSelector.php     |  2 ++
 .../Listeners/DrupalComponentTestListenerTrait.php  |  2 ++
 .../tests/Drupal/Tests/Listeners/DrupalListener.php |  2 ++
 .../Drupal/Tests/Listeners/HtmlOutputPrinter.php    |  2 ++
 .../Tests/Listeners/HtmlOutputPrinterTrait.php      |  2 ++
 core/tests/Drupal/Tests/PerformanceData.php         |  2 ++
 core/tests/Drupal/Tests/PhpUnitWarningsTest.php     |  2 ++
 core/tests/Drupal/Tests/StreamCapturer.php          |  2 ++
 core/tests/Drupal/Tests/UnitTestCase.php            |  2 ++
 core/tests/Drupal/Tests/UnitTestCaseTest.php        |  2 ++
 core/tests/Drupal/Tests/WebAssert.php               |  2 ++
 core/tests/TestSuites/BuildTestSuite.php            |  2 ++
 .../TestSuites/FunctionalJavascriptTestSuite.php    |  2 ++
 core/tests/TestSuites/FunctionalTestSuite.php       |  2 ++
 core/tests/TestSuites/KernelTestSuite.php           |  2 ++
 core/tests/TestSuites/TestSuiteBase.php             |  2 ++
 core/tests/TestSuites/UnitTestSuite.php             |  2 ++
 50 files changed, 105 insertions(+), 8 deletions(-)

diff --git a/core/modules/field/tests/src/Functional/NestedFormTest.php b/core/modules/field/tests/src/Functional/NestedFormTest.php
index 4bd2f97c6b26..0ce18389f94f 100644
--- a/core/modules/field/tests/src/Functional/NestedFormTest.php
+++ b/core/modules/field/tests/src/Functional/NestedFormTest.php
@@ -217,7 +217,7 @@ public function testNestedEntityFormEntityLevelValidation() {
 
     // Display the 'combined form'.
     $this->drupalGet("test-entity-constraints/nested/{$entity_1->id()}/{$entity_2->id()}");
-    $assert_session->hiddenFieldValueEquals('entity_2[changed]', REQUEST_TIME);
+    $assert_session->hiddenFieldValueEquals('entity_2[changed]', (string) REQUEST_TIME);
 
     // Submit the form and check that the entities are updated accordingly.
     $assert_session->hiddenFieldExists('entity_2[changed]')
diff --git a/core/modules/system/src/Tests/Routing/MockAliasManager.php b/core/modules/system/src/Tests/Routing/MockAliasManager.php
index 5299281d44f9..7412e6d6dbe6 100644
--- a/core/modules/system/src/Tests/Routing/MockAliasManager.php
+++ b/core/modules/system/src/Tests/Routing/MockAliasManager.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\system\Tests\Routing;
 
 use Drupal\path_alias\AliasManagerInterface;
diff --git a/core/modules/system/src/Tests/Routing/MockRouteProvider.php b/core/modules/system/src/Tests/Routing/MockRouteProvider.php
index 7c34358dec6b..47dc717140d9 100644
--- a/core/modules/system/src/Tests/Routing/MockRouteProvider.php
+++ b/core/modules/system/src/Tests/Routing/MockRouteProvider.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\system\Tests\Routing;
 
 use Symfony\Component\HttpFoundation\Request;
diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist
index 195479831ccb..3b910afac93d 100644
--- a/core/phpcs.xml.dist
+++ b/core/phpcs.xml.dist
@@ -277,14 +277,15 @@
     <include-pattern>*/tests/src/FunctionalJavascript/*</include-pattern>
     <include-pattern>*/tests/src/Traits/*</include-pattern>
     <include-pattern>*/tests/src/Unit/*</include-pattern>
-    <include-pattern>./tests/Drupal/BuildTests/*</include-pattern>
-    <include-pattern>./tests/Drupal/FunctionalJavascriptTests/*</include-pattern>
-    <include-pattern>./tests/Drupal/Tests/*/*.php</include-pattern>
-    <include-pattern>./tests/Drupal/Tests/*Trait.php</include-pattern>
-    <include-pattern>./tests/Drupal/Tests/Traits/*</include-pattern>
-    <exclude-pattern>./tests/Drupal/Tests/Listeners/*</exclude-pattern>
+    <include-pattern>./tests/Drupal/*</include-pattern>
+    <include-pattern>./tests/TestSuites/*</include-pattern>
+    <include-pattern>./modules/system/src/Tests/Routing/*</include-pattern>
     <exclude-pattern>./tests/Drupal/Tests/*/Fixture/*</exclude-pattern>
     <exclude-pattern>./tests/Drupal/Tests/*/fixtures/*</exclude-pattern>
+    <!-- @todo remove after https://www.drupal.org/node/3399746 -->
+    <exclude-pattern>./tests/Drupal/FunctionalTests/*</exclude-pattern>
+    <!-- @todo remove after https://www.drupal.org/node/3399388 -->
+    <exclude-pattern>./tests/Drupal/KernelTests/*</exclude-pattern>
   </rule>
 
   <!-- Squiz sniffs -->
diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
index f164d5bf694c..7c952fdb9faa 100644
--- a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
+++ b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite\Commands;
 
 use Drupal\Core\Config\ConfigImporter;
diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteReleaseLocksCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteReleaseLocksCommand.php
index f2b606aec75d..cd9b97bf43e3 100644
--- a/core/tests/Drupal/TestSite/Commands/TestSiteReleaseLocksCommand.php
+++ b/core/tests/Drupal/TestSite/Commands/TestSiteReleaseLocksCommand.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite\Commands;
 
 use Drupal\Core\Test\TestDatabase;
diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php
index efde0539d947..d3ca19973c11 100644
--- a/core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php
+++ b/core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite\Commands;
 
 use Drupal\Core\Database\Database;
diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteUserLoginCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteUserLoginCommand.php
index 82cfb91f8a23..f94ab8213530 100644
--- a/core/tests/Drupal/TestSite/Commands/TestSiteUserLoginCommand.php
+++ b/core/tests/Drupal/TestSite/Commands/TestSiteUserLoginCommand.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite\Commands;
 
 use Drupal\Core\DrupalKernel;
diff --git a/core/tests/Drupal/TestSite/TestPreinstallInterface.php b/core/tests/Drupal/TestSite/TestPreinstallInterface.php
index e209fd0142cd..c8c23e2409bc 100644
--- a/core/tests/Drupal/TestSite/TestPreinstallInterface.php
+++ b/core/tests/Drupal/TestSite/TestPreinstallInterface.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite;
 
 /**
diff --git a/core/tests/Drupal/TestSite/TestSetupInterface.php b/core/tests/Drupal/TestSite/TestSetupInterface.php
index 06c9717eb56d..1a20e1244a16 100644
--- a/core/tests/Drupal/TestSite/TestSetupInterface.php
+++ b/core/tests/Drupal/TestSite/TestSetupInterface.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite;
 
 /**
diff --git a/core/tests/Drupal/TestSite/TestSiteApplication.php b/core/tests/Drupal/TestSite/TestSiteApplication.php
index 7b2c22c2fb3c..309f8d489725 100644
--- a/core/tests/Drupal/TestSite/TestSiteApplication.php
+++ b/core/tests/Drupal/TestSite/TestSiteApplication.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite;
 
 use Drupal\TestSite\Commands\TestSiteInstallCommand;
diff --git a/core/tests/Drupal/TestSite/TestSiteInstallTestScript.php b/core/tests/Drupal/TestSite/TestSiteInstallTestScript.php
index 1f6f9644fce0..7fc5494e33e2 100644
--- a/core/tests/Drupal/TestSite/TestSiteInstallTestScript.php
+++ b/core/tests/Drupal/TestSite/TestSiteInstallTestScript.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite;
 
 /**
diff --git a/core/tests/Drupal/TestSite/TestSiteMultilingualInstallTestScript.php b/core/tests/Drupal/TestSite/TestSiteMultilingualInstallTestScript.php
index ed04d89e1b27..2aa5d62cdb2f 100644
--- a/core/tests/Drupal/TestSite/TestSiteMultilingualInstallTestScript.php
+++ b/core/tests/Drupal/TestSite/TestSiteMultilingualInstallTestScript.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite;
 
 // cspell:ignore enregistrer
diff --git a/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php b/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
index a02c8d3a0430..87f73336cf0c 100644
--- a/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
+++ b/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestSite;
 
 use Drupal\Core\Extension\ModuleInstallerInterface;
diff --git a/core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php b/core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php
index cc49088bb321..00499e599725 100644
--- a/core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php
+++ b/core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestTools\Comparator;
 
 use Drupal\Component\Render\MarkupInterface;
diff --git a/core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php b/core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php
index 96f9dfc5f80c..39eb33dfcd34 100644
--- a/core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php
+++ b/core/tests/Drupal/TestTools/Extension/RequiresComposerTrait.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestTools\Extension;
 
 use Symfony\Component\Process\ExecutableFinder;
diff --git a/core/tests/Drupal/TestTools/Extension/SchemaInspector.php b/core/tests/Drupal/TestTools/Extension/SchemaInspector.php
index 134ad27e084d..f90521bbbb53 100644
--- a/core/tests/Drupal/TestTools/Extension/SchemaInspector.php
+++ b/core/tests/Drupal/TestTools/Extension/SchemaInspector.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestTools\Extension;
 
 use Drupal\Core\Extension\ModuleHandlerInterface;
diff --git a/core/tests/Drupal/TestTools/PhpUnitCompatibility/ClassWriter.php b/core/tests/Drupal/TestTools/PhpUnitCompatibility/ClassWriter.php
index 4b3f9cf92632..76d5deb891db 100644
--- a/core/tests/Drupal/TestTools/PhpUnitCompatibility/ClassWriter.php
+++ b/core/tests/Drupal/TestTools/PhpUnitCompatibility/ClassWriter.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestTools\PhpUnitCompatibility;
 
 use Composer\Autoload\ClassLoader;
diff --git a/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php b/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php
index 590fc337be2e..4bb8b01e1945 100644
--- a/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php
+++ b/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestTools\PhpUnitCompatibility\PhpUnit9;
 
 /**
diff --git a/core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php b/core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php
index b929b02d30e7..46c9fb1be88c 100644
--- a/core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php
+++ b/core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestTools\PhpUnitCompatibility;
 
 use PHPUnit\Runner\Version;
diff --git a/core/tests/Drupal/TestTools/Random.php b/core/tests/Drupal/TestTools/Random.php
index 35de4a781446..e68bc09bb496 100644
--- a/core/tests/Drupal/TestTools/Random.php
+++ b/core/tests/Drupal/TestTools/Random.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestTools;
 
 use Drupal\Component\Utility\Random as RandomUtility;
@@ -53,7 +55,7 @@ public static function string(int $length = 8): string {
     // To prevent the introduction of random test failures, ensure that the
     // returned string contains a character that needs to be escaped in HTML by
     // injecting an ampersand into it.
-    $replacement_pos = floor($length / 2);
+    $replacement_pos = intval($length / 2);
     // Remove 2 from the length to account for the ampersand and greater than
     // characters.
     $string = static::getGenerator()->string($length - 2, TRUE, [static::class, 'stringValidate']);
diff --git a/core/tests/Drupal/TestTools/TestVarDumper.php b/core/tests/Drupal/TestTools/TestVarDumper.php
index b47ffd704f8b..67d6136e155f 100644
--- a/core/tests/Drupal/TestTools/TestVarDumper.php
+++ b/core/tests/Drupal/TestTools/TestVarDumper.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\TestTools;
 
 use Symfony\Component\VarDumper\Cloner\VarCloner;
diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php
index 35e8f55e9449..fc6173bfc143 100644
--- a/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 use Behat\Mink\Driver\BrowserKitDriver;
diff --git a/core/tests/Drupal/Tests/ComposerIntegrationTest.php b/core/tests/Drupal/Tests/ComposerIntegrationTest.php
index 854b495a0f95..dedd18729223 100644
--- a/core/tests/Drupal/Tests/ComposerIntegrationTest.php
+++ b/core/tests/Drupal/Tests/ComposerIntegrationTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 use Drupal\Composer\Plugin\VendorHardening\Config;
diff --git a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/hook_include.inc b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/hook_include.inc
index ed4fb4647169..5e7e8cd0a15b 100644
--- a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/hook_include.inc
+++ b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/hook_include.inc
@@ -5,6 +5,8 @@
  * Include file for test module.
  */
 
+declare(strict_types=1);
+
 /**
  * Test hook.
  */
diff --git a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.module b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.module
index ea0d93d89b21..f6d036a7d697 100644
--- a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.module
+++ b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.module
@@ -5,6 +5,8 @@
  * Test module.
  */
 
+declare(strict_types=1);
+
 /**
  * Implements hook_hook_info().
  */
diff --git a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added/module_handler_test_added.hook.inc b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added/module_handler_test_added.hook.inc
index 88e00574b498..f25f194202c6 100644
--- a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added/module_handler_test_added.hook.inc
+++ b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added/module_handler_test_added.hook.inc
@@ -5,6 +5,8 @@
  * Include file for test module.
  */
 
+declare(strict_types=1);
+
 /**
  * Test function.
  */
diff --git a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added/module_handler_test_added.module b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added/module_handler_test_added.module
index 09e54197eeca..e217ec4d8eaa 100644
--- a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added/module_handler_test_added.module
+++ b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added/module_handler_test_added.module
@@ -5,6 +5,8 @@
  * Test module.
  */
 
+declare(strict_types=1);
+
 /**
  * Test function.
  */
diff --git a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1/module_handler_test_all1.module b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1/module_handler_test_all1.module
index 29d8de5e1195..6ef8b2e6ae09 100644
--- a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1/module_handler_test_all1.module
+++ b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1/module_handler_test_all1.module
@@ -5,6 +5,8 @@
  * Test module.
  */
 
+declare(strict_types=1);
+
 /**
  * Returns an array to test nested merge in invoke all.
  */
diff --git a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all2/module_handler_test_all2.module b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all2/module_handler_test_all2.module
index 6915a52a8d84..e0be768f8bce 100644
--- a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all2/module_handler_test_all2.module
+++ b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all2/module_handler_test_all2.module
@@ -5,6 +5,8 @@
  * Test module.
  */
 
+declare(strict_types=1);
+
 /**
  * Test function.
  */
diff --git a/core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc b/core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
index b7623f768524..0e34dd9110d5 100644
--- a/core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
+++ b/core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
@@ -5,6 +5,8 @@
  * Functions in the global namespace for \Drupal\Tests\Core\Form\FormTestBase.
  */
 
+declare(strict_types=1);
+
 /**
  * Creates a test form.
  *
diff --git a/core/tests/Drupal/Tests/DrupalTestBrowser.php b/core/tests/Drupal/Tests/DrupalTestBrowser.php
index 8546e785c2bd..ddcc3dd908f4 100644
--- a/core/tests/Drupal/Tests/DrupalTestBrowser.php
+++ b/core/tests/Drupal/Tests/DrupalTestBrowser.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 use GuzzleHttp\Client;
diff --git a/core/tests/Drupal/Tests/ExpectDeprecationTest.php b/core/tests/Drupal/Tests/ExpectDeprecationTest.php
index be62d5d4cb71..8fc2b4c872a5 100644
--- a/core/tests/Drupal/Tests/ExpectDeprecationTest.php
+++ b/core/tests/Drupal/Tests/ExpectDeprecationTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 use PHPUnit\Framework\TestCase;
diff --git a/core/tests/Drupal/Tests/HiddenFieldSelector.php b/core/tests/Drupal/Tests/HiddenFieldSelector.php
index b445c4873822..8869ae0a8225 100644
--- a/core/tests/Drupal/Tests/HiddenFieldSelector.php
+++ b/core/tests/Drupal/Tests/HiddenFieldSelector.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 use Behat\Mink\Selector\PartialNamedSelector;
diff --git a/core/tests/Drupal/Tests/Listeners/DrupalComponentTestListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DrupalComponentTestListenerTrait.php
index 9730c37dedd6..90a5638e2dc0 100644
--- a/core/tests/Drupal/Tests/Listeners/DrupalComponentTestListenerTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/DrupalComponentTestListenerTrait.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\Listeners;
 
 use Drupal\KernelTests\KernelTestBase;
diff --git a/core/tests/Drupal/Tests/Listeners/DrupalListener.php b/core/tests/Drupal/Tests/Listeners/DrupalListener.php
index 1a1a9db32f2b..182e4fe4e7b2 100644
--- a/core/tests/Drupal/Tests/Listeners/DrupalListener.php
+++ b/core/tests/Drupal/Tests/Listeners/DrupalListener.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\Listeners;
 
 use PHPUnit\Framework\TestListener;
diff --git a/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinter.php b/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinter.php
index 69eae01fd167..dcfd8e80e2ff 100644
--- a/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinter.php
+++ b/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinter.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\Listeners;
 
 use PHPUnit\Framework\TestResult;
diff --git a/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php b/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php
index 4bdfa54e00e3..33507046884a 100644
--- a/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\Listeners;
 
 /**
diff --git a/core/tests/Drupal/Tests/PerformanceData.php b/core/tests/Drupal/Tests/PerformanceData.php
index 0336c3a398e3..4db5c05435e4 100644
--- a/core/tests/Drupal/Tests/PerformanceData.php
+++ b/core/tests/Drupal/Tests/PerformanceData.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 /**
diff --git a/core/tests/Drupal/Tests/PhpUnitWarningsTest.php b/core/tests/Drupal/Tests/PhpUnitWarningsTest.php
index 2e635be472a9..67d632928fb1 100644
--- a/core/tests/Drupal/Tests/PhpUnitWarningsTest.php
+++ b/core/tests/Drupal/Tests/PhpUnitWarningsTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 /**
diff --git a/core/tests/Drupal/Tests/StreamCapturer.php b/core/tests/Drupal/Tests/StreamCapturer.php
index 4d71bc7505e3..eb7d54aa9b76 100644
--- a/core/tests/Drupal/Tests/StreamCapturer.php
+++ b/core/tests/Drupal/Tests/StreamCapturer.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 /**
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index 9306d7d36222..2ca419d204be 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 use Drupal\Component\FileCache\FileCacheFactory;
diff --git a/core/tests/Drupal/Tests/UnitTestCaseTest.php b/core/tests/Drupal/Tests/UnitTestCaseTest.php
index 375d2e5dba1c..4d5a7948a877 100644
--- a/core/tests/Drupal/Tests/UnitTestCaseTest.php
+++ b/core/tests/Drupal/Tests/UnitTestCaseTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 use Drupal\Component\Utility\Random;
diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php
index d8f9006e3fd5..9c36f9339e7e 100644
--- a/core/tests/Drupal/Tests/WebAssert.php
+++ b/core/tests/Drupal/Tests/WebAssert.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests;
 
 use Behat\Mink\Exception\ExpectationException;
diff --git a/core/tests/TestSuites/BuildTestSuite.php b/core/tests/TestSuites/BuildTestSuite.php
index 3de8e11a9695..39c4660c7aae 100644
--- a/core/tests/TestSuites/BuildTestSuite.php
+++ b/core/tests/TestSuites/BuildTestSuite.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\TestSuites;
 
 require_once __DIR__ . '/TestSuiteBase.php';
diff --git a/core/tests/TestSuites/FunctionalJavascriptTestSuite.php b/core/tests/TestSuites/FunctionalJavascriptTestSuite.php
index ad516dbd34d2..d026e725e82a 100644
--- a/core/tests/TestSuites/FunctionalJavascriptTestSuite.php
+++ b/core/tests/TestSuites/FunctionalJavascriptTestSuite.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\TestSuites;
 
 require_once __DIR__ . '/TestSuiteBase.php';
diff --git a/core/tests/TestSuites/FunctionalTestSuite.php b/core/tests/TestSuites/FunctionalTestSuite.php
index b6763e1280bb..1ddbde2b32e4 100644
--- a/core/tests/TestSuites/FunctionalTestSuite.php
+++ b/core/tests/TestSuites/FunctionalTestSuite.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\TestSuites;
 
 require_once __DIR__ . '/TestSuiteBase.php';
diff --git a/core/tests/TestSuites/KernelTestSuite.php b/core/tests/TestSuites/KernelTestSuite.php
index 2a5657a7b627..1fb4be33f4c3 100644
--- a/core/tests/TestSuites/KernelTestSuite.php
+++ b/core/tests/TestSuites/KernelTestSuite.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\TestSuites;
 
 require_once __DIR__ . '/TestSuiteBase.php';
diff --git a/core/tests/TestSuites/TestSuiteBase.php b/core/tests/TestSuites/TestSuiteBase.php
index bd68d3d9886b..70ee9f7c5a1f 100644
--- a/core/tests/TestSuites/TestSuiteBase.php
+++ b/core/tests/TestSuites/TestSuiteBase.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\TestSuites;
 
 use Drupal\Core\Test\TestDiscovery;
diff --git a/core/tests/TestSuites/UnitTestSuite.php b/core/tests/TestSuites/UnitTestSuite.php
index 8e3a0fe6c09c..c24d8f85b94f 100644
--- a/core/tests/TestSuites/UnitTestSuite.php
+++ b/core/tests/TestSuites/UnitTestSuite.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\TestSuites;
 
 require_once __DIR__ . '/TestSuiteBase.php';
-- 
GitLab