diff --git a/composer.json b/composer.json
index 58280b5ed161be756f791299ed47ad836a54dc0c..cc5fae64ad5e5bfaa95f80a3b241a74091cfce08 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,7 @@
         "phpunit/phpunit": "^8.4.1",
         "phpspec/prophecy": "^1.7",
         "symfony/css-selector": "^4.4",
-        "symfony/phpunit-bridge": "^5.1",
+        "symfony/phpunit-bridge": "^5.1.3",
         "symfony/error-handler": "^4.4",
         "justinrainbow/json-schema": "^5.2",
         "symfony/filesystem": "^4.4",
diff --git a/composer.lock b/composer.lock
index 8c83b73a3d8745027209201134bcd409ccafcdad..e1a11c10570e6c061d009a6e5ecc8dbeba8c04a7 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "70ccf971aa2cc71e172543e89d868b90",
+    "content-hash": "c6355fee8b620a19067108002e315194",
     "packages": [
         {
             "name": "asm89/stack-cors",
@@ -183,16 +183,6 @@
                 "zend",
                 "zikula"
             ],
-            "funding": [
-                {
-                    "url": "https://packagist.com",
-                    "type": "custom"
-                },
-                {
-                    "url": "https://tidelift.com/funding/github/packagist/composer/composer",
-                    "type": "tidelift"
-                }
-            ],
             "time": "2020-04-07T06:57:05+00:00"
         },
         {
@@ -385,20 +375,6 @@
                 "parser",
                 "php"
             ],
-            "funding": [
-                {
-                    "url": "https://www.doctrine-project.org/sponsorship.html",
-                    "type": "custom"
-                },
-                {
-                    "url": "https://www.patreon.com/phpdoctrine",
-                    "type": "patreon"
-                },
-                {
-                    "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer",
-                    "type": "tidelift"
-                }
-            ],
             "time": "2020-05-25T17:44:05+00:00"
         },
         {
@@ -1348,12 +1324,6 @@
                 "laminas",
                 "zf"
             ],
-            "funding": [
-                {
-                    "url": "https://funding.communitybridge.org/projects/laminas-project",
-                    "type": "community_bridge"
-                }
-            ],
             "time": "2020-05-20T16:45:56+00:00"
         },
         {
@@ -4487,16 +4457,6 @@
                 "ssl",
                 "tls"
             ],
-            "funding": [
-                {
-                    "url": "https://packagist.com",
-                    "type": "custom"
-                },
-                {
-                    "url": "https://tidelift.com/funding/github/packagist/composer/composer",
-                    "type": "tidelift"
-                }
-            ],
             "time": "2020-04-08T08:27:21+00:00"
         },
         {
@@ -4762,20 +4722,6 @@
                 "constructor",
                 "instantiate"
             ],
-            "funding": [
-                {
-                    "url": "https://www.doctrine-project.org/sponsorship.html",
-                    "type": "custom"
-                },
-                {
-                    "url": "https://www.patreon.com/phpdoctrine",
-                    "type": "patreon"
-                },
-                {
-                    "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
-                    "type": "tidelift"
-                }
-            ],
             "time": "2020-05-29T17:27:14+00:00"
         },
         {
@@ -6477,16 +6423,6 @@
                 "parser",
                 "validator"
             ],
-            "funding": [
-                {
-                    "url": "https://github.com/Seldaek",
-                    "type": "github"
-                },
-                {
-                    "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint",
-                    "type": "tidelift"
-                }
-            ],
             "time": "2020-04-30T19:05:18+00:00"
         },
         {
@@ -7007,16 +6943,16 @@
         },
         {
             "name": "symfony/phpunit-bridge",
-            "version": "v5.1.2",
+            "version": "v5.1.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/phpunit-bridge.git",
-                "reference": "de5f0fec631a0cbfe98630b053be1fad7b75aece"
+                "reference": "964bd57046dfa48687e1412fe5f8006adfcb9675"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/de5f0fec631a0cbfe98630b053be1fad7b75aece",
-                "reference": "de5f0fec631a0cbfe98630b053be1fad7b75aece",
+                "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/964bd57046dfa48687e1412fe5f8006adfcb9675",
+                "reference": "964bd57046dfa48687e1412fe5f8006adfcb9675",
                 "shasum": ""
             },
             "require": {
@@ -7068,9 +7004,6 @@
             ],
             "description": "Symfony PHPUnit Bridge",
             "homepage": "https://symfony.com",
-            "support": {
-                "source": "https://github.com/symfony/phpunit-bridge/tree/v5.1.1"
-            },
             "funding": [
                 {
                     "url": "https://symfony.com/sponsor",
@@ -7085,7 +7018,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2020-06-09T09:56:30+00:00"
+            "time": "2020-07-23T09:26:24+00:00"
         },
         {
             "name": "theseer/tokenizer",
diff --git a/composer/Metapackage/DevDependencies/composer.json b/composer/Metapackage/DevDependencies/composer.json
index caa8e154c5f0978a7ad0fa34a71cfaedbbeff580..e0b9a93d4af36f6600561c221045c2e98b8dd637 100644
--- a/composer/Metapackage/DevDependencies/composer.json
+++ b/composer/Metapackage/DevDependencies/composer.json
@@ -24,6 +24,6 @@
         "symfony/filesystem": "^4.4",
         "symfony/finder": "^4.4",
         "symfony/lock": "^4.4",
-        "symfony/phpunit-bridge": "^5.1"
+        "symfony/phpunit-bridge": "^5.1.3"
     }
 }
diff --git a/composer/Metapackage/PinnedDevDependencies/composer.json b/composer/Metapackage/PinnedDevDependencies/composer.json
index 7ac5fd994897942c33481e0688f861648f19aa58..e95a5706d1d3376e3145a5ca557fe116e9637c4d 100644
--- a/composer/Metapackage/PinnedDevDependencies/composer.json
+++ b/composer/Metapackage/PinnedDevDependencies/composer.json
@@ -57,7 +57,7 @@
         "symfony/filesystem": "v4.4.10",
         "symfony/finder": "v4.4.10",
         "symfony/lock": "v4.4.10",
-        "symfony/phpunit-bridge": "v5.1.2",
+        "symfony/phpunit-bridge": "v5.1.3",
         "theseer/tokenizer": "1.1.3",
         "webmozart/assert": "1.9.0"
     }
diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestMapFieldResourceTestBase.php b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestMapFieldResourceTestBase.php
index 9a836b97e5a92cd23c4b9ba549e4f196abc99348..cea0a49e7a1ba12af716f8d197d9d21fab518961 100644
--- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestMapFieldResourceTestBase.php
+++ b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestMapFieldResourceTestBase.php
@@ -4,13 +4,10 @@
 
 use Drupal\entity_test\Entity\EntityTestMapField;
 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
-use Drupal\Tests\Traits\ExpectDeprecationTrait;
 use Drupal\user\Entity\User;
 
 abstract class EntityTestMapFieldResourceTestBase extends EntityResourceTestBase {
 
-  use ExpectDeprecationTrait;
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php
index c05982924e1370ec3af436c039eabc7c68218775..836fb3e6e030976d885885bd0b555b44bda7fe38 100644
--- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php
+++ b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php
@@ -5,13 +5,11 @@
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
 use Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait;
-use Drupal\Tests\Traits\ExpectDeprecationTrait;
 use Drupal\user\Entity\User;
 
 abstract class EntityTestResourceTestBase extends EntityResourceTestBase {
 
   use EntityDefinitionTestTrait;
-  use ExpectDeprecationTrait;
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php
index 70ca24e4a3f74674487a73100232122e31b1b216..fa25970de03ad84a2b2320be34a9e68233d1f1f2 100644
--- a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php
@@ -14,7 +14,6 @@
 use Drupal\Core\TypedData\Plugin\DataType\StringData;
 use Drupal\Core\TypedData\TypedDataManagerInterface;
 use Drupal\KernelTests\KernelTestBase;
-use Drupal\Tests\Traits\ExpectDeprecationTrait;
 
 /**
  * @coversDefaultClass \Drupal\Core\Plugin\ContextAwarePluginBase
@@ -23,8 +22,6 @@
  */
 class ContextAwarePluginBaseTest extends KernelTestBase {
 
-  use ExpectDeprecationTrait;
-
   /**
    * The plugin instance under test.
    *
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index ddc85b9c70cadf55115581a6160706d469b275f9..74a9129c6dd42075594cc007cbd99026f037509e 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -12,7 +12,6 @@
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\TypedData\TypedDataManagerInterface;
-use Drupal\Tests\Traits\ExpectDeprecationTrait;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Language\Language;
 use Symfony\Component\Validator\Validator\ValidatorInterface;
@@ -24,8 +23,6 @@
  */
 class ContentEntityBaseUnitTest extends UnitTestCase {
 
-  use ExpectDeprecationTrait;
-
   /**
    * The bundle of the entity under test.
    *
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
index 83e1f7cb4b7cf231959ce8be201596eaa688ae01..3edaf4c7f925508726930326f06d74bd073a410c 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
@@ -10,7 +10,6 @@
 use Drupal\Core\Entity\EntityTypeRepositoryInterface;
 use Drupal\Core\Language\Language;
 use Drupal\entity_test\Entity\EntityTestMul;
-use Drupal\Tests\Traits\ExpectDeprecationTrait;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -20,8 +19,6 @@
  */
 class EntityUnitTest extends UnitTestCase {
 
-  use ExpectDeprecationTrait;
-
   /**
    * The entity under test.
    *
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php b/core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php
index 390db1544dd23731afd99dceedb467d946ec4d9f..a2e78e2e407609569f0e1c6df396c16d4574a2d1 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php
@@ -3,7 +3,6 @@
 namespace Drupal\Tests\Core\Render;
 
 use Drupal\Core\Security\UntrustedCallbackException;
-use Drupal\Tests\Traits\ExpectDeprecationTrait;
 
 /**
  * @coversDefaultClass \Drupal\Core\Render\Renderer
@@ -11,8 +10,6 @@
  */
 class RendererCallbackTest extends RendererTestBase {
 
-  use ExpectDeprecationTrait;
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
index 14b9731999c8e6dc1383de4dc019718d3e2fff14..a7bd8098b2b847722c979c7b7130cd3301f4d9a9 100644
--- a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
+++ b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
@@ -3,9 +3,9 @@
 namespace Drupal\Tests\Core\Site;
 
 use Drupal\Core\Site\Settings;
-use Drupal\Tests\Traits\ExpectDeprecationTrait;
 use Drupal\Tests\UnitTestCase;
 use org\bovigo\vfs\vfsStream;
+use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
 
 /**
  * @coversDefaultClass \Drupal\Core\Site\Settings
@@ -202,7 +202,7 @@ public function testFakeDeprecatedSettings(array $settings_config, string $setti
     $instance_property->setValue($deprecated_settings);
 
     if ($expect_deprecation_message) {
-      $this->addExpectedDeprecationMessage($deprecated_setting['message']);
+      $this->expectDeprecation($deprecated_setting['message']);
     }
 
     Settings::initialize(vfsStream::url('root'), 'sites', $class_loader);
diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php
index 8190f8cfd56c7ed3f911339ba41568ea5688b8ef..e29f42ab780560ab92e690d0546d8fbb2070c191 100644
--- a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php
+++ b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php
@@ -4,7 +4,6 @@
 
 use Drupal\Core\Site\Settings;
 use Drupal\Core\StackMiddleware\ReverseProxyMiddleware;
-use Drupal\Tests\Traits\ExpectDeprecationTrait;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -14,7 +13,6 @@
  * @group StackMiddleware
  */
 class ReverseProxyMiddlewareTest extends UnitTestCase {
-  use ExpectDeprecationTrait;
 
   /**
    * @var \Symfony\Component\HttpKernel\HttpKernelInterface|\PHPUnit\Framework\MockObject\MockObject
diff --git a/core/tests/Drupal/Tests/ExpectDeprecationTest.php b/core/tests/Drupal/Tests/ExpectDeprecationTest.php
index 0a44fd55ce5d1eb8a0072f8f76d7b2700386098c..49c07c933b17013b6abe602cefc4a17186d405be 100644
--- a/core/tests/Drupal/Tests/ExpectDeprecationTest.php
+++ b/core/tests/Drupal/Tests/ExpectDeprecationTest.php
@@ -9,12 +9,17 @@
  *
  * @group Test
  * @group legacy
+ *
+ * Do not remove this test when \Drupal\Tests\Traits\ExpectDeprecationTrait is
+ * removed. Change it to use \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait
+ * instead to ensure Drupal has test coverage of Symfony's deprecation testing.
  */
 class ExpectDeprecationTest extends UnitTestCase {
   use ExpectDeprecationTrait;
 
   /**
    * @covers ::addExpectedDeprecationMessage
+   * @expectedDeprecation Drupal\Tests\Traits\ExpectDeprecationTrait::addExpectedDeprecationMessage() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait::expectDeprecation() instead. See https://www.drupal.org/node/3161901
    */
   public function testExpectDeprecation() {
     $this->addExpectedDeprecationMessage('Test deprecation');
@@ -25,10 +30,12 @@ public function testExpectDeprecation() {
    * @covers ::addExpectedDeprecationMessage
    * @runInSeparateProcess
    * @preserveGlobalState disabled
+   * @expectedDeprecation Drupal\Tests\Traits\ExpectDeprecationTrait::addExpectedDeprecationMessage() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait::expectDeprecation() instead. See https://www.drupal.org/node/3161901
+   * @expectedDeprecation Drupal\Tests\Traits\ExpectDeprecationTrait::expectedDeprecations() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait::expectDeprecation() instead. See https://www.drupal.org/node/3161901
    */
   public function testExpectDeprecationInIsolation() {
     $this->addExpectedDeprecationMessage('Test isolated deprecation');
-    $this->addExpectedDeprecationMessage('Test isolated deprecation2');
+    $this->expectedDeprecations(['Test isolated deprecation2']);
     @trigger_error('Test isolated deprecation', E_USER_DEPRECATED);
     @trigger_error('Test isolated deprecation2', E_USER_DEPRECATED);
   }
diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
index 2bc74b6e02a7479112ef1596f7bf07a335877c6a..c82034fea493e32712a004ed89eaae4053f06685 100644
--- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
@@ -2,8 +2,6 @@
 
 namespace Drupal\Tests\Listeners;
 
-use Drupal\Tests\Traits\ExpectDeprecationTrait;
-use PHPUnit\Framework\TestCase;
 use PHPUnit\Util\Test;
 
 /**
@@ -15,8 +13,6 @@
  */
 trait DeprecationListenerTrait {
 
-  use ExpectDeprecationTrait;
-
   /**
    * The previous error handler.
    *
@@ -24,14 +20,6 @@ trait DeprecationListenerTrait {
    */
   private $previousHandler;
 
-  protected function deprecationStartTest($test) {
-    if ($test instanceof TestCase) {
-      if ($this->willBeIsolated($test)) {
-        putenv('DRUPAL_EXPECTED_DEPRECATIONS_SERIALIZE=' . tempnam(sys_get_temp_dir(), 'exdep'));
-      }
-    }
-  }
-
   /**
    * Reacts to the end of a test.
    *
@@ -42,13 +30,6 @@ protected function deprecationStartTest($test) {
    */
   protected function deprecationEndTest($test, $time) {
     /** @var \PHPUnit\Framework\Test $test */
-    if ($file = getenv('DRUPAL_EXPECTED_DEPRECATIONS_SERIALIZE')) {
-      putenv('DRUPAL_EXPECTED_DEPRECATIONS_SERIALIZE');
-      $expected_deprecations = file_get_contents($file);
-      if ($expected_deprecations) {
-        $test->expectedDeprecations(unserialize($expected_deprecations));
-      }
-    }
     if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
       $method = $test->getName(FALSE);
       if (strpos($method, 'testLegacy') === 0
@@ -77,26 +58,6 @@ protected function deprecationEndTest($test, $time) {
     }
   }
 
-  /**
-   * Determines if a test is isolated.
-   *
-   * @param \PHPUnit\Framework\TestCase $test
-   *   The test to check.
-   *
-   * @return bool
-   *   TRUE if the isolated, FALSE if not.
-   */
-  private function willBeIsolated($test) {
-    if ($test->isInIsolation()) {
-      return FALSE;
-    }
-
-    $r = new \ReflectionProperty($test, 'runTestInSeparateProcess');
-    $r->setAccessible(TRUE);
-
-    return $r->getValue($test);
-  }
-
   /**
    * Determines if a deprecation error should be skipped.
    *
diff --git a/core/tests/Drupal/Tests/Listeners/DrupalListener.php b/core/tests/Drupal/Tests/Listeners/DrupalListener.php
index 686c08ebfaded4ef6f0c32faef9a0ed8b4a10182..ccff1d9f4170b01716667072cd576d7513f3b931 100644
--- a/core/tests/Drupal/Tests/Listeners/DrupalListener.php
+++ b/core/tests/Drupal/Tests/Listeners/DrupalListener.php
@@ -81,7 +81,6 @@ public function startTest(Test $test): void {
     // \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::startTest()
     // that handles expected deprecations.
     $this->registerErrorHandler();
-    $this->deprecationStartTest($test);
     $this->symfonyListener->startTest($test);
     // Check for missing void return typehints in concrete test classes'
     // methods. If the method is inherited from a base test class, do
diff --git a/core/tests/Drupal/Tests/Traits/ExpectDeprecationTrait.php b/core/tests/Drupal/Tests/Traits/ExpectDeprecationTrait.php
index d093c011c20f8f8862ba8e513d9ab6a349c4c55e..7dbb17665f37121dbcae6ff36aca0d4a0f961d3b 100644
--- a/core/tests/Drupal/Tests/Traits/ExpectDeprecationTrait.php
+++ b/core/tests/Drupal/Tests/Traits/ExpectDeprecationTrait.php
@@ -2,17 +2,20 @@
 
 namespace Drupal\Tests\Traits;
 
-use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait;
+use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait as SymfonyExpectDeprecationTrait;
 
 /**
  * Adds the ability to dynamically set expected deprecation messages in tests.
  *
  * @internal
  *
- * @todo https://www.drupal.org/project/drupal/issues/3157434 Deprecate the
- *   trait and its methods.
+ * @deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use
+ *   \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait instead.
+ *
+ * @see https://www.drupal.org/node/3161901
  */
 trait ExpectDeprecationTrait {
+  use SymfonyExpectDeprecationTrait;
 
   /**
    * Sets an expected deprecation message.
@@ -21,7 +24,8 @@ trait ExpectDeprecationTrait {
    *   The expected deprecation message.
    */
   protected function addExpectedDeprecationMessage($message) {
-    $this->expectedDeprecations([$message]);
+    @trigger_error(__METHOD__ . '() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait::expectDeprecation() instead. See https://www.drupal.org/node/3161901', E_USER_DEPRECATED);
+    $this->expectDeprecation($message);
   }
 
   /**
@@ -33,29 +37,9 @@ protected function addExpectedDeprecationMessage($message) {
    * @see \Symfony\Bridge\PhpUnit\Legacy\ExpectDeprecationTraitForV8_4::expectDeprecation()
    */
   public function expectedDeprecations(array $messages) {
-    $this->getTestResultObject()->beStrictAboutTestsThatDoNotTestAnything(FALSE);
-
-    // Expected deprecations set by isolated tests need to be written to a file
-    // so that the test running process can take account of them.
-    if ($file = getenv('DRUPAL_EXPECTED_DEPRECATIONS_SERIALIZE')) {
-      $expected_deprecations = file_get_contents($file);
-      if ($expected_deprecations) {
-        $expected_deprecations = array_merge(unserialize($expected_deprecations), $messages);
-      }
-      else {
-        $expected_deprecations = $messages;
-      }
-      file_put_contents($file, serialize($expected_deprecations));
-    }
-    else {
-      // Copy code from ExpectDeprecationTraitForV8_4::expectDeprecation().
-      if (!SymfonyTestsListenerTrait::$previousErrorHandler) {
-        SymfonyTestsListenerTrait::$previousErrorHandler = set_error_handler([SymfonyTestsListenerTrait::class, 'handleError']);
-      }
-
-      foreach ($messages as $message) {
-        SymfonyTestsListenerTrait::$expectedDeprecations[] = $message;
-      }
+    @trigger_error(__METHOD__ . '() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait::expectDeprecation() instead. See https://www.drupal.org/node/3161901', E_USER_DEPRECATED);
+    foreach ($messages as $message) {
+      $this->expectDeprecation($message);
     }
   }