diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index c30a4a8f631da80152dbcb0aa2301ed5442032b0..7c6cda9769ca22f1da478bd39b13ee7b8c71ad27 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -3272,11 +3272,6 @@ parameters:
 			count: 1
 			path: tests/Drupal/Tests/Composer/ComposerTest.php
 
-		-
-			message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#"
-			count: 1
-			path: tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
-
 		-
 			message: """
 				#^Call to deprecated method expectError\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\:
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
index 627cef0feff4eedf0c09a35c0fbffa7dafdd8f3d..d5c6b68bce95b9ba3fca21f1354c7d8f37cdf5ab 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
@@ -309,12 +309,12 @@ public function testUpdateCacheDelete() {
     ];
     // Set up mock expectation, on the second call the with the second argument
     // set to TRUE because we triggered a cache invalidation.
+    $allow_invalid = [FALSE, TRUE];
     $this->cacheBackend->expects($this->exactly(2))
       ->method('get')
-      ->withConsecutive(
-        [$this->cid],
-        [$this->cid, TRUE],
-      )
+      ->with($this->cid, $this->callback(function ($value) use (&$allow_invalid) {
+        return array_shift($allow_invalid) === $value;
+      }))
       ->willReturn($cache);
 
     $this->collector->delete($key);