diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index 83cd841eac933162d20d0e945e489c71e7065844..8cd9bc4532117f987efdd2a1f6a5be23ba8a5070 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -2217,14 +2217,6 @@ parameters:
 			count: 1
 			path: tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php
 
-		-
-			message: """
-				#^Call to deprecated method expectErrorMessage\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\:
-				https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$#
-			"""
-			count: 1
-			path: tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php
-
 		-
 			message: "#^Variable \\$value in isset\\(\\) always exists and is not nullable\\.$#"
 			count: 1
diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php
index 74c3e95a963b5b4794f16e6c651050deefa62d28..247b6cc064c88c9b45bdafbc5badefac02115e85 100644
--- a/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php
@@ -66,7 +66,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    */
   public function testMachineNameOrderException() {
     $this->expectException(\LogicException::class);
-    $this->expectErrorMessage('The machine name element "test_machine_name" is defined before the source element "test_source", it must be defined after or the source element must specify an id.');
+    $this->expectExceptionMessage('The machine name element "test_machine_name" is defined before the source element "test_source", it must be defined after or the source element must specify an id.');
     $form = \Drupal::formBuilder()->getForm($this);
     $this->render($form);
   }