diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index bca57388b903a8be9e2345c22cd32b1e6a959a92..fcd08f7ce2f829cccbd8b3e1c175114ef365194f 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -173,7 +173,7 @@ protected function ensureTableExists() {
       return TRUE;
     }
     catch (\Exception $e) {
-      throw new StorageException($e->getMessage(), NULL, $e);
+      throw new StorageException($e->getMessage(), 0, $e);
     }
     return FALSE;
   }
diff --git a/core/lib/Drupal/Core/FileTransfer/FTPExtension.php b/core/lib/Drupal/Core/FileTransfer/FTPExtension.php
index 99c1c0688125e738180c7e206a01153282e3e924..74da1b0dcf28754f597867b8fe780c5241d4c929 100644
--- a/core/lib/Drupal/Core/FileTransfer/FTPExtension.php
+++ b/core/lib/Drupal/Core/FileTransfer/FTPExtension.php
@@ -26,7 +26,7 @@ public function connect() {
    */
   protected function copyFileJailed($source, $destination) {
     if (!@ftp_put($this->connection, $destination, $source, FTP_BINARY)) {
-      throw new FileTransferException("Cannot move @source to @destination", NULL, ["@source" => $source, "@destination" => $destination]);
+      throw new FileTransferException("Cannot move @source to @destination", 0, ["@source" => $source, "@destination" => $destination]);
     }
   }
 
@@ -35,7 +35,7 @@ protected function copyFileJailed($source, $destination) {
    */
   protected function createDirectoryJailed($directory) {
     if (!ftp_mkdir($this->connection, $directory)) {
-      throw new FileTransferException("Cannot create directory @directory", NULL, ["@directory" => $directory]);
+      throw new FileTransferException("Cannot create directory @directory", 0, ["@directory" => $directory]);
     }
   }
 
@@ -45,7 +45,7 @@ protected function createDirectoryJailed($directory) {
   protected function removeDirectoryJailed($directory) {
     $pwd = ftp_pwd($this->connection);
     if (!ftp_chdir($this->connection, $directory)) {
-      throw new FileTransferException("Unable to change the current directory to @directory", NULL, ['@directory' => $directory]);
+      throw new FileTransferException("Unable to change the current directory to @directory", 0, ['@directory' => $directory]);
     }
     $list = @ftp_nlist($this->connection, '.');
     if (!$list) {
@@ -65,7 +65,7 @@ protected function removeDirectoryJailed($directory) {
     }
     ftp_chdir($this->connection, $pwd);
     if (!ftp_rmdir($this->connection, $directory)) {
-      throw new FileTransferException("Unable to remove the directory @directory", NULL, ['@directory' => $directory]);
+      throw new FileTransferException("Unable to remove the directory @directory", 0, ['@directory' => $directory]);
     }
   }
 
@@ -74,7 +74,7 @@ protected function removeDirectoryJailed($directory) {
    */
   protected function removeFileJailed($destination) {
     if (!ftp_delete($this->connection, $destination)) {
-      throw new FileTransferException("Unable to remove the file @file", NULL, ['@file' => $destination]);
+      throw new FileTransferException("Unable to remove the file @file", 0, ['@file' => $destination]);
     }
   }
 
@@ -103,7 +103,7 @@ public function isFile($path) {
    */
   public function chmodJailed($path, $mode, $recursive) {
     if (!ftp_chmod($this->connection, $mode, $path)) {
-      throw new FileTransferException("Unable to set permissions on %file", NULL, ['%file' => $path]);
+      throw new FileTransferException("Unable to set permissions on %file", 0, ['%file' => $path]);
     }
     if ($this->isDirectory($path) && $recursive) {
       $filelist = @ftp_nlist($this->connection, $path);
diff --git a/core/lib/Drupal/Core/FileTransfer/FileTransfer.php b/core/lib/Drupal/Core/FileTransfer/FileTransfer.php
index c1b3055b444eeb2b3f057570e121f313beba097d..9b1c65275e1dc3e9245eb1d386783ee02be081fb 100644
--- a/core/lib/Drupal/Core/FileTransfer/FileTransfer.php
+++ b/core/lib/Drupal/Core/FileTransfer/FileTransfer.php
@@ -211,7 +211,7 @@ final protected function checkPath($path) {
       ->realpath(substr($this->chroot . $path, 0, strlen($full_jail)));
     $full_path = $this->fixRemotePath($full_path, FALSE);
     if ($full_jail !== $full_path) {
-      throw new FileTransferException('@directory is outside of the @jail', NULL, ['@directory' => $path, '@jail' => $this->jail]);
+      throw new FileTransferException('@directory is outside of the @jail', 0, ['@directory' => $path, '@jail' => $this->jail]);
     }
   }
 
diff --git a/core/lib/Drupal/Core/FileTransfer/Local.php b/core/lib/Drupal/Core/FileTransfer/Local.php
index 693713557cce5d5f42523ec6082d58d416e91325..791f01a4fc3e0c21156534f5ab2cb81cbb8eb78c 100644
--- a/core/lib/Drupal/Core/FileTransfer/Local.php
+++ b/core/lib/Drupal/Core/FileTransfer/Local.php
@@ -46,7 +46,7 @@ public static function factory($jail, $settings) {
    */
   protected function copyFileJailed($source, $destination) {
     if (@!copy($source, $destination)) {
-      throw new FileTransferException('Cannot copy %source to %destination.', NULL, ['%source' => $source, '%destination' => $destination]);
+      throw new FileTransferException('Cannot copy %source to %destination.', 0, ['%source' => $source, '%destination' => $destination]);
     }
   }
 
@@ -55,7 +55,7 @@ protected function copyFileJailed($source, $destination) {
    */
   protected function createDirectoryJailed($directory) {
     if (!is_dir($directory) && @!mkdir($directory, 0777, TRUE)) {
-      throw new FileTransferException('Cannot create directory %directory.', NULL, ['%directory' => $directory]);
+      throw new FileTransferException('Cannot create directory %directory.', 0, ['%directory' => $directory]);
     }
   }
 
@@ -65,24 +65,24 @@ protected function createDirectoryJailed($directory) {
   protected function removeDirectoryJailed($directory) {
     if (!is_dir($directory)) {
       // Programmer error assertion, not something we expect users to see.
-      throw new FileTransferException('removeDirectoryJailed() called with a path (%directory) that is not a directory.', NULL, ['%directory' => $directory]);
+      throw new FileTransferException('removeDirectoryJailed() called with a path (%directory) that is not a directory.', 0, ['%directory' => $directory]);
     }
     /** @var \Drupal\Core\File\FileSystemInterface $file_system */
     $file_system = \Drupal::service('file_system');
     foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST) as $filename => $file) {
       if ($file->isDir()) {
         if (@!$file_system->rmdir($filename)) {
-          throw new FileTransferException('Cannot remove directory %directory.', NULL, ['%directory' => $filename]);
+          throw new FileTransferException('Cannot remove directory %directory.', 0, ['%directory' => $filename]);
         }
       }
       elseif ($file->isFile()) {
         if (@!$this->fileSystem->unlink($filename)) {
-          throw new FileTransferException('Cannot remove file %file.', NULL, ['%file' => $filename]);
+          throw new FileTransferException('Cannot remove file %file.', 0, ['%file' => $filename]);
         }
       }
     }
     if (@!$file_system->rmdir($directory)) {
-      throw new FileTransferException('Cannot remove directory %directory.', NULL, ['%directory' => $directory]);
+      throw new FileTransferException('Cannot remove directory %directory.', 0, ['%directory' => $directory]);
     }
   }
 
@@ -91,7 +91,7 @@ protected function removeDirectoryJailed($directory) {
    */
   protected function removeFileJailed($file) {
     if (@!$this->fileSystem->unlink($file)) {
-      throw new FileTransferException('Cannot remove file %file.', NULL, ['%file' => $file]);
+      throw new FileTransferException('Cannot remove file %file.', 0, ['%file' => $file]);
     }
   }
 
@@ -116,12 +116,12 @@ public function chmodJailed($path, $mode, $recursive) {
     if ($recursive && is_dir($path)) {
       foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $filename => $file) {
         if (@!chmod($filename, $mode)) {
-          throw new FileTransferException('Cannot chmod %path.', NULL, ['%path' => $filename]);
+          throw new FileTransferException('Cannot chmod %path.', 0, ['%path' => $filename]);
         }
       }
     }
     elseif (@!chmod($path, $mode)) {
-      throw new FileTransferException('Cannot chmod %path.', NULL, ['%path' => $path]);
+      throw new FileTransferException('Cannot chmod %path.', 0, ['%path' => $path]);
     }
   }
 
diff --git a/core/lib/Drupal/Core/FileTransfer/SSH.php b/core/lib/Drupal/Core/FileTransfer/SSH.php
index 5795526e93f8514595bff8916efeb0c765b38b46..e6b883f32b014bf875eabb065b18cf8584ac2e9a 100644
--- a/core/lib/Drupal/Core/FileTransfer/SSH.php
+++ b/core/lib/Drupal/Core/FileTransfer/SSH.php
@@ -24,7 +24,7 @@ public function __construct($jail, $username, $password, $hostname = "localhost"
   public function connect() {
     $this->connection = @ssh2_connect($this->hostname, $this->port);
     if (!$this->connection) {
-      throw new FileTransferException('SSH Connection failed to @host:@port', NULL, ['@host' => $this->hostname, '@port' => $this->port]);
+      throw new FileTransferException('SSH Connection failed to @host:@port', 0, ['@host' => $this->hostname, '@port' => $this->port]);
     }
     if (!@ssh2_auth_password($this->connection, $this->username, $this->password)) {
       throw new FileTransferException('The supplied username/password combination was not accepted.');
@@ -47,7 +47,7 @@ public static function factory($jail, $settings) {
    */
   protected function copyFileJailed($source, $destination) {
     if (!@ssh2_scp_send($this->connection, $source, $destination)) {
-      throw new FileTransferException('Cannot copy @source_file to @destination_file.', NULL, ['@source' => $source, '@destination' => $destination]);
+      throw new FileTransferException('Cannot copy @source_file to @destination_file.', 0, ['@source' => $source, '@destination' => $destination]);
     }
   }
 
@@ -56,7 +56,7 @@ protected function copyFileJailed($source, $destination) {
    */
   protected function copyDirectoryJailed($source, $destination) {
     if (@!ssh2_exec($this->connection, 'cp -Rp ' . escapeshellarg($source) . ' ' . escapeshellarg($destination))) {
-      throw new FileTransferException('Cannot copy directory @directory.', NULL, ['@directory' => $source]);
+      throw new FileTransferException('Cannot copy directory @directory.', 0, ['@directory' => $source]);
     }
   }
 
@@ -65,7 +65,7 @@ protected function copyDirectoryJailed($source, $destination) {
    */
   protected function createDirectoryJailed($directory) {
     if (@!ssh2_exec($this->connection, 'mkdir ' . escapeshellarg($directory))) {
-      throw new FileTransferException('Cannot create directory @directory.', NULL, ['@directory' => $directory]);
+      throw new FileTransferException('Cannot create directory @directory.', 0, ['@directory' => $directory]);
     }
   }
 
@@ -74,7 +74,7 @@ protected function createDirectoryJailed($directory) {
    */
   protected function removeDirectoryJailed($directory) {
     if (@!ssh2_exec($this->connection, 'rm -Rf ' . escapeshellarg($directory))) {
-      throw new FileTransferException('Cannot remove @directory.', NULL, ['@directory' => $directory]);
+      throw new FileTransferException('Cannot remove @directory.', 0, ['@directory' => $directory]);
     }
   }
 
@@ -83,7 +83,7 @@ protected function removeDirectoryJailed($directory) {
    */
   protected function removeFileJailed($destination) {
     if (!@ssh2_exec($this->connection, 'rm ' . escapeshellarg($destination))) {
-      throw new FileTransferException('Cannot remove @directory.', NULL, ['@directory' => $destination]);
+      throw new FileTransferException('Cannot remove @directory.', 0, ['@directory' => $destination]);
     }
   }
 
@@ -103,7 +103,7 @@ public function isDirectory($path) {
       return FALSE;
     }
     else {
-      throw new FileTransferException('Cannot check @path.', NULL, ['@path' => $path]);
+      throw new FileTransferException('Cannot check @path.', 0, ['@path' => $path]);
     }
   }
 
@@ -120,7 +120,7 @@ public function isFile($path) {
       return FALSE;
     }
     else {
-      throw new FileTransferException('Cannot check @path.', NULL, ['@path' => $path]);
+      throw new FileTransferException('Cannot check @path.', 0, ['@path' => $path]);
     }
   }
 
@@ -130,7 +130,7 @@ public function isFile($path) {
   public function chmodJailed($path, $mode, $recursive) {
     $cmd = sprintf("chmod %s%o %s", $recursive ? '-R ' : '', $mode, escapeshellarg($path));
     if (@!ssh2_exec($this->connection, $cmd)) {
-      throw new FileTransferException('Cannot change permissions of @path.', NULL, ['@path' => $path]);
+      throw new FileTransferException('Cannot change permissions of @path.', 0, ['@path' => $path]);
     }
   }
 
diff --git a/core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php b/core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php
index aadc57e176cd46d0599fad21c1d07ca991bac3a6..5d8ec67dde4de0a292b3549c61c583486b4932a2 100644
--- a/core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php
+++ b/core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php
@@ -18,7 +18,13 @@ class CacheableHttpException extends HttpException implements CacheableDependenc
    */
   public function __construct(CacheableDependencyInterface $cacheability, $statusCode = 0, $message = NULL, \Exception $previous = NULL, $code = 0) {
     $this->setCacheability($cacheability);
-    parent::__construct($statusCode, $message, $previous, $code);
+    // @todo Remove condition in https://www.drupal.org/node/3002352
+    if (is_array($code)) {
+      parent::__construct($statusCode, $message, $previous, $code);
+    }
+    else {
+      parent::__construct($statusCode, $message, $previous, [], $code);
+    }
   }
 
 }
diff --git a/core/lib/Drupal/Core/Menu/MenuTreeStorage.php b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php
index 34059a33501545ff8928856b11ea932b4ef99c5d..ae2a2c176813743e4420b050518e55e36cb7f1e3 100644
--- a/core/lib/Drupal/Core/Menu/MenuTreeStorage.php
+++ b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php
@@ -1175,7 +1175,7 @@ protected function ensureTableExists() {
       return TRUE;
     }
     catch (\Exception $e) {
-      throw new PluginException($e->getMessage(), NULL, $e);
+      throw new PluginException($e->getMessage(), 0, $e);
     }
     return FALSE;
   }
diff --git a/core/modules/jsonapi/src/Revisions/ResourceVersionRouteEnhancer.php b/core/modules/jsonapi/src/Revisions/ResourceVersionRouteEnhancer.php
index bc7694fafb8c87c8e6787c98d0baca0ce6d0c09d..ad2186bef7c0953db1ced1a2f1020852185ea486 100644
--- a/core/modules/jsonapi/src/Revisions/ResourceVersionRouteEnhancer.php
+++ b/core/modules/jsonapi/src/Revisions/ResourceVersionRouteEnhancer.php
@@ -105,7 +105,7 @@ public function enhance(array $defaults, Request $request) {
         $message = 'JSON:API does not yet support resource versioning for this resource type.';
         $message .= ' For context, see https://www.drupal.org/project/drupal/issues/2992833#comment-12818258.';
         $message .= ' To contribute, see https://www.drupal.org/project/drupal/issues/2350939 and https://www.drupal.org/project/drupal/issues/2809177.';
-        throw new CacheableHttpException($cacheability, 501, $message, NULL, []);
+        throw new CacheableHttpException($cacheability, 501, $message, NULL, 0);
       }
       return $defaults;
     }
@@ -151,7 +151,7 @@ public function enhance(array $defaults, Request $request) {
         ];
         $cacheability = (new CacheableMetadata())->addCacheContexts($cache_contexts);
         $message = 'JSON:API does not support filtering on revisions other than the latest version because a secure Drupal core API does not yet exist to do so.';
-        throw new CacheableHttpException($cacheability, 501, $message, NULL, []);
+        throw new CacheableHttpException($cacheability, 501, $message, NULL, 0);
       }
       // 'latest-version' and 'working-copy' are the only acceptable version
       // identifiers for a collection resource.