diff --git a/core/modules/system/tests/src/Kernel/Common/PageRenderTest.php b/core/modules/system/tests/src/Kernel/Common/PageRenderTest.php
index a7842b480a8704d17358e29c3aa12679ad7b09da..616c3037cd133d7e82ee58c017f0ef17fc538ae7 100644
--- a/core/modules/system/tests/src/Kernel/Common/PageRenderTest.php
+++ b/core/modules/system/tests/src/Kernel/Common/PageRenderTest.php
@@ -56,7 +56,7 @@ public function assertPageRenderHookExceptions(string $module, string $hook): vo
     $page = [];
     try {
       $html_renderer->invokePageAttachmentHooks($page);
-      $this->error($assertion);
+      $this->fail($assertion);
     }
     catch (\LogicException $e) {
       $this->assertEquals('Only #attached and #cache may be set in ' . $hook . '().', $e->getMessage());
@@ -69,7 +69,7 @@ public function assertPageRenderHookExceptions(string $module, string $hook): vo
     $page = [];
     try {
       $html_renderer->invokePageAttachmentHooks($page);
-      $this->error($assertion);
+      $this->fail($assertion);
     }
     catch (\LogicException $e) {
       $this->assertEquals('Only #attached and #cache may be set in ' . $hook . '().', $e->getMessage());
diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index eed79b4d4b31353bbf3ba921c2ce1f4a61a9d50d..10ac55102806fadcc3f0c56ecf26e603e81b9702 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -1115,11 +1115,6 @@ parameters:
 			count: 1
 			path: modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php
 
-		-
-			message: "#^Call to an undefined method Drupal\\\\Tests\\\\system\\\\Kernel\\\\Common\\\\PageRenderTest\\:\\:error\\(\\)\\.$#"
-			count: 2
-			path: modules/system/tests/src/Kernel/Common/PageRenderTest.php
-
 		-
 			message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:10\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#"
 			count: 1