diff --git a/composer.json b/composer.json
index f92a1909850f25dbdf2a6b9e31b2d8f4f4c53064..0989029af185c2ceddbfebd00969ca170e808998 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,7 @@
         "php-http/guzzle7-adapter": "^1.0",
         "phpspec/prophecy-phpunit": "^2",
         "phpstan/extension-installer": "^1.1",
-        "phpstan/phpstan": "^1.11.0",
+        "phpstan/phpstan": "^1.11.8",
         "phpstan/phpstan-phpunit": "^1.3.16",
         "phpunit/phpunit": "^10.5.19",
         "symfony/browser-kit": "^7.1",
diff --git a/composer.lock b/composer.lock
index 79521a43753810b0a77d5112d299350a72ad240e..ec0944944496c66a37a930e6228bc6a35fac45db 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": "a7381d9c8398db71aa38d0efa7daa309",
+    "content-hash": "0f1d1a247b1cc704077dcea4f3268b44",
     "packages": [
         {
             "name": "asm89/stack-cors",
@@ -7012,16 +7012,16 @@
         },
         {
             "name": "phpstan/phpstan",
-            "version": "1.11.7",
+            "version": "1.11.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpstan/phpstan.git",
-                "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d"
+                "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52d2bbfdcae7f895915629e4694e9497d0f8e28d",
-                "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d",
+                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec",
+                "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec",
                 "shasum": ""
             },
             "require": {
@@ -7066,7 +7066,7 @@
                     "type": "github"
                 }
             ],
-            "time": "2024-07-06T11:17:41+00:00"
+            "time": "2024-07-24T07:01:22+00:00"
         },
         {
             "name": "phpstan/phpstan-deprecation-rules",
diff --git a/composer/Metapackage/DevDependencies/composer.json b/composer/Metapackage/DevDependencies/composer.json
index 82e593ad2b4f56f725203215f291cd3a7eb3c071..972a50e8200f3d5050f9f06d2b00147afc6adf03 100644
--- a/composer/Metapackage/DevDependencies/composer.json
+++ b/composer/Metapackage/DevDependencies/composer.json
@@ -23,7 +23,7 @@
         "php-http/guzzle7-adapter": "^1.0",
         "phpspec/prophecy-phpunit": "^2",
         "phpstan/extension-installer": "^1.1",
-        "phpstan/phpstan": "^1.11.0",
+        "phpstan/phpstan": "^1.11.8",
         "phpstan/phpstan-phpunit": "^1.3.16",
         "phpunit/phpunit": "^10.5.19",
         "symfony/browser-kit": "^7.1",
diff --git a/composer/Metapackage/PinnedDevDependencies/composer.json b/composer/Metapackage/PinnedDevDependencies/composer.json
index 4f417748915504b57a98b6839788b02b400d364c..82c506c9edb207600b74a48932577a3a60f00922 100644
--- a/composer/Metapackage/PinnedDevDependencies/composer.json
+++ b/composer/Metapackage/PinnedDevDependencies/composer.json
@@ -49,7 +49,7 @@
         "phpspec/prophecy-phpunit": "v2.2.0",
         "phpstan/extension-installer": "1.4.1",
         "phpstan/phpdoc-parser": "1.29.1",
-        "phpstan/phpstan": "1.11.7",
+        "phpstan/phpstan": "1.11.8",
         "phpstan/phpstan-deprecation-rules": "1.2.0",
         "phpstan/phpstan-phpunit": "1.4.0",
         "phpunit/php-code-coverage": "10.1.15",
diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php
index 72c71990c672b2c8e7d7f0309a2f9fa0714736ae..e9920a355f2d483267d8026b3415a4df0ea74bac 100644
--- a/core/.phpstan-baseline.php
+++ b/core/.phpstan-baseline.php
@@ -34,7 +34,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Function install_download_translation\\(\\) should return string but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/includes/install.core.inc',
 ];
 $ignoreErrors[] = [
@@ -697,7 +697,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\block_content\\\\BlockContentForm\\:\\:save\\(\\) should return int but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/block_content/src/BlockContentForm.php',
 ];
 $ignoreErrors[] = [
@@ -787,7 +787,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\contact\\\\MessageForm\\:\\:save\\(\\) should return int but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/contact/src/MessageForm.php',
 ];
 $ignoreErrors[] = [
@@ -955,7 +955,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\file\\\\Plugin\\\\Field\\\\FieldType\\\\FileFieldItemList\\:\\:postSave\\(\\) should return bool but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php',
 ];
 $ignoreErrors[] = [
@@ -1153,7 +1153,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\locale\\\\LocaleDefaultConfigStorage\\:\\:read\\(\\) should return array but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/locale/src/LocaleDefaultConfigStorage.php',
 ];
 $ignoreErrors[] = [
@@ -1455,13 +1455,13 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\node\\\\ConfigTranslation\\\\NodeTypeMapper\\:\\:setEntity\\(\\) should return bool but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/node/src/ConfigTranslation/NodeTypeMapper.php',
 ];
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\node\\\\NodeForm\\:\\:save\\(\\) should return int but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/node/src/NodeForm.php',
 ];
 $ignoreErrors[] = [
@@ -1545,7 +1545,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\path\\\\Plugin\\\\Field\\\\FieldType\\\\PathItem\\:\\:postSave\\(\\) should return bool but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 3,
 	'path' => __DIR__ . '/modules/path/src/Plugin/Field/FieldType/PathItem.php',
 ];
 $ignoreErrors[] = [
@@ -1569,7 +1569,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\responsive_image\\\\ResponsiveImageStyleForm\\:\\:save\\(\\) should return int but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/responsive_image/src/ResponsiveImageStyleForm.php',
 ];
 $ignoreErrors[] = [
@@ -1800,7 +1800,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\taxonomy\\\\TermForm\\:\\:validateForm\\(\\) should return Drupal\\\\Core\\\\Entity\\\\ContentEntityInterface but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/taxonomy/src/TermForm.php',
 ];
 $ignoreErrors[] = [
@@ -1860,7 +1860,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\user\\\\RegisterForm\\:\\:save\\(\\) should return int but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 4,
 	'path' => __DIR__ . '/modules/user/src/RegisterForm.php',
 ];
 $ignoreErrors[] = [
@@ -2256,7 +2256,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\views_ui\\\\ViewUI\\:\\:set\\(\\) should return \\$this\\(Drupal\\\\views_ui\\\\ViewUI\\) but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/views_ui/src/ViewUI.php',
 ];
 $ignoreErrors[] = [
@@ -2310,7 +2310,7 @@
 $ignoreErrors[] = [
 	// identifier: return.missing
 	'message' => '#^Method Drupal\\\\workspaces\\\\Form\\\\WorkspaceForm\\:\\:save\\(\\) should return int but return statement is missing\\.$#',
-	'count' => 1,
+	'count' => 2,
 	'path' => __DIR__ . '/modules/workspaces/src/Form/WorkspaceForm.php',
 ];
 $ignoreErrors[] = [
diff --git a/core/modules/file/src/EventSubscriber/FileEventSubscriber.php b/core/modules/file/src/EventSubscriber/FileEventSubscriber.php
index 17608c583fb48589fa5824c8c66da3fbe9fb9cb4..9eec27195f4a24341f4491b0f6c42c1d1d13cbef 100644
--- a/core/modules/file/src/EventSubscriber/FileEventSubscriber.php
+++ b/core/modules/file/src/EventSubscriber/FileEventSubscriber.php
@@ -90,7 +90,7 @@ public function sanitizeFilename(FileUploadSanitizeNameEvent $event) {
       $filename = preg_replace('/(_)_+|(\.)\.+|(-)-+/u', $replacement, $filename);
       // Replace multiple separators with single one.
       $filename = preg_replace('/(_|\.|\-)[(_|\.|\-)]+/u', $replacement, $filename);
-      $filename = preg_replace('/' . preg_quote($replacement) . '[' . preg_quote($replacement) . ']*/u', $replacement, $filename);
+      $filename = preg_replace('/' . preg_quote($replacement, NULL) . '[' . preg_quote($replacement, NULL) . ']*/u', $replacement, $filename);
       // Remove replacement character from the end of the filename.
       $filename = rtrim($filename, $replacement);
 
diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
index e55a6ffa402b12e88889be947919f19fa2ff1ed6..04f13e3681898c37858a357561ba691123000c22 100644
--- a/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
+++ b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
@@ -576,14 +576,14 @@ public function renameTable($table, $new_name) {
       // cSpell:disable-next-line
       // Example (drupal_Gk7Su_T1jcBHVuvSPeP22_I3Ni4GrVEgTYlIYnBJkro_idx).
       if (str_contains($index->indexname, 'drupal_')) {
-        preg_match('/^drupal_(.*)_' . preg_quote($index_type) . '/', $index->indexname, $matches);
+        preg_match('/^drupal_(.*)_' . preg_quote($index_type, NULL) . '/', $index->indexname, $matches);
         $index_name = $matches[1];
       }
       else {
         // Make sure to remove the suffix from index names, because
         // $this->ensureIdentifiersLength() will add the suffix again and thus
         // would result in a wrong index name.
-        preg_match('/^' . preg_quote($table_name) . '__(.*)__' . preg_quote($index_type) . '/', $index->indexname, $matches);
+        preg_match('/^' . preg_quote($table_name, NULL) . '__(.*)__' . preg_quote($index_type, NULL) . '/', $index->indexname, $matches);
         $index_name = $matches[1];
       }
       // The renaming of an index will fail when the there exists an table with
diff --git a/core/modules/sqlite/src/Driver/Database/sqlite/Statement.php b/core/modules/sqlite/src/Driver/Database/sqlite/Statement.php
index a3842b213a94cc4225b84f6c4bfd1f18a6bd3fec..d7d8daf46ac9d3f2b339b10b0965ca4e6784a23b 100644
--- a/core/modules/sqlite/src/Driver/Database/sqlite/Statement.php
+++ b/core/modules/sqlite/src/Driver/Database/sqlite/Statement.php
@@ -73,7 +73,7 @@ protected function getStatement(string $query, ?array &$args = []): object {
             // When replacing the placeholders, make sure we search for the
             // exact placeholder. For example, if searching for
             // ':db_placeholder_1', do not replace ':db_placeholder_11'.
-            $query = preg_replace('/' . preg_quote($placeholder) . '\b/', $value, $query);
+            $query = preg_replace('/' . preg_quote($placeholder, NULL) . '\b/', $value, $query);
           }
         }
       }
diff --git a/core/tests/Drupal/KernelTests/AssertContentTrait.php b/core/tests/Drupal/KernelTests/AssertContentTrait.php
index 03e560bc0e6a06b210fc16dec138a82d4a69e953..fa9ce3faced1b3db5d74306587b6e492f8de14aa 100644
--- a/core/tests/Drupal/KernelTests/AssertContentTrait.php
+++ b/core/tests/Drupal/KernelTests/AssertContentTrait.php
@@ -182,7 +182,7 @@ protected function buildXPathQuery($xpath, array $args = []) {
       $replacement = function ($matches) use ($value) {
         return $value;
       };
-      $xpath = preg_replace_callback('/' . preg_quote($placeholder) . '\b/', $replacement, $xpath);
+      $xpath = preg_replace_callback('/' . preg_quote($placeholder, NULL) . '\b/', $replacement, $xpath);
     }
     return $xpath;
   }
diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php
index a60597aa6658e56c29e926634d3e6ac42c309444..a2b26d8d523b967c2129dc1636108c1acba346b7 100644
--- a/core/tests/Drupal/Tests/WebAssert.php
+++ b/core/tests/Drupal/Tests/WebAssert.php
@@ -513,7 +513,7 @@ public function buildXPathQuery($xpath, array $args = []) {
       $replacement = function ($matches) use ($value) {
         return $value;
       };
-      $xpath = preg_replace_callback('/' . preg_quote($placeholder) . '\b/', $replacement, $xpath);
+      $xpath = preg_replace_callback('/' . preg_quote($placeholder, NULL) . '\b/', $replacement, $xpath);
     }
     return $xpath;
   }
diff --git a/core/tests/PHPStan/composer.json b/core/tests/PHPStan/composer.json
index 0437e786dac736ed9e6395d028d63229ff61a184..c78bab07e8a9a5c724a8e3cd4abcbbe51a46fd27 100644
--- a/core/tests/PHPStan/composer.json
+++ b/core/tests/PHPStan/composer.json
@@ -3,7 +3,7 @@
     "description": "Tests Drupal core's PHPStan rules",
     "require-dev": {
         "phpunit/phpunit": "^9",
-        "phpstan/phpstan": "1.11.7"
+        "phpstan/phpstan": "1.11.8"
     },
     "license": "GPL-2.0-or-later",
     "autoload": {