From 97ffc69fd0122fff3b582e912c3120a46d7e815a Mon Sep 17 00:00:00 2001
From: xjm <xjm@65776.no-reply.drupal.org>
Date: Sun, 25 Dec 2022 13:16:26 -0600
Subject: [PATCH] Issue #3324838 by Spokje: Fix PHPStan L2 error "PHPDoc tag
 @throws with type Foo is not subtype of Throwable"

---
 core/lib/Drupal/Core/Config/DatabaseStorage.php           | 6 +++---
 core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php  | 2 +-
 core/lib/Drupal/Core/Routing/FilterInterface.php          | 2 +-
 core/lib/Drupal/Core/Validation/TranslatorInterface.php   | 2 +-
 core/modules/language/src/Entity/ConfigurableLanguage.php | 2 +-
 core/modules/locale/src/PoDatabaseReader.php              | 2 +-
 core/modules/locale/src/PoDatabaseWriter.php              | 2 +-
 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php    | 2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index 7626bf50802c..c40e70ee224c 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -215,7 +215,7 @@ protected static function schemaDefinition() {
   /**
    * Implements Drupal\Core\Config\StorageInterface::delete().
    *
-   * @throws PDOException
+   * @throws \PDOException
    *
    * @todo Ignore replica targets for data manipulation operations.
    */
@@ -232,7 +232,7 @@ public function delete($name) {
   /**
    * Implements Drupal\Core\Config\StorageInterface::rename().
    *
-   * @throws PDOException
+   * @throws \PDOException
    */
   public function rename($name, $new_name) {
     // @todo Remove the 'return' option in Drupal 11.
@@ -255,7 +255,7 @@ public function encode($data) {
   /**
    * Implements Drupal\Core\Config\StorageInterface::decode().
    *
-   * @throws ErrorException
+   * @throws \ErrorException
    *   The unserialize() call will trigger E_NOTICE if the string cannot
    *   be unserialized.
    */
diff --git a/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php b/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
index 18cea0fd1b26..d690b5a59941 100644
--- a/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
+++ b/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
@@ -146,7 +146,7 @@ public function themeExists($theme);
    * @return \Drupal\Core\Extension\Extension
    *   An extension object.
    *
-   * @throws \Drupal\Core\Extension\Extension\UnknownExtensionException
+   * @throws \Drupal\Core\Extension\Exception\UnknownExtensionException
    *   Thrown when the requested theme does not exist.
    */
   public function getTheme($name);
diff --git a/core/lib/Drupal/Core/Routing/FilterInterface.php b/core/lib/Drupal/Core/Routing/FilterInterface.php
index ca40c9b4d7d3..5f7008867780 100644
--- a/core/lib/Drupal/Core/Routing/FilterInterface.php
+++ b/core/lib/Drupal/Core/Routing/FilterInterface.php
@@ -22,7 +22,7 @@ interface FilterInterface {
    * @return \Symfony\Component\Routing\RouteCollection
    *   A non-empty RouteCollection of matched routes
    *
-   * @throws ResourceNotFoundException
+   * @throws \Symfony\Component\Routing\Exception\ResourceNotFoundException
    *   If none of the routes in $collection matches $request. This is a
    *   performance optimization to not continue the match process when a match
    *   will no longer be possible.
diff --git a/core/lib/Drupal/Core/Validation/TranslatorInterface.php b/core/lib/Drupal/Core/Validation/TranslatorInterface.php
index e59e766ffdb6..65df2a2babcd 100644
--- a/core/lib/Drupal/Core/Validation/TranslatorInterface.php
+++ b/core/lib/Drupal/Core/Validation/TranslatorInterface.php
@@ -29,7 +29,7 @@ interface TranslatorInterface {
    * @return string
    *   The translated string.
    *
-   * @throws InvalidArgumentException
+   * @throws \InvalidArgumentException
    *   If the locale contains invalid characters.
    */
   public function trans($id, array $parameters = [], $domain = NULL, $locale = NULL);
diff --git a/core/modules/language/src/Entity/ConfigurableLanguage.php b/core/modules/language/src/Entity/ConfigurableLanguage.php
index 5dbdeda0eff1..c8f246bf91c4 100644
--- a/core/modules/language/src/Entity/ConfigurableLanguage.php
+++ b/core/modules/language/src/Entity/ConfigurableLanguage.php
@@ -166,7 +166,7 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) {
   /**
    * {@inheritdoc}
    *
-   * @throws \DeleteDefaultLanguageException
+   * @throws \Drupal\language\Exception\DeleteDefaultLanguageException
    *   Exception thrown if we're trying to delete the default language entity.
    *   This is not allowed as a site must have a default language.
    */
diff --git a/core/modules/locale/src/PoDatabaseReader.php b/core/modules/locale/src/PoDatabaseReader.php
index 55c2b690ada8..4ed76634676b 100644
--- a/core/modules/locale/src/PoDatabaseReader.php
+++ b/core/modules/locale/src/PoDatabaseReader.php
@@ -91,7 +91,7 @@ public function getHeader() {
   /**
    * Implements Drupal\Component\Gettext\PoMetadataInterface::setHeader().
    *
-   * @throws Exception
+   * @throws \Exception
    *   Always, because you cannot set the PO header of a reader.
    */
   public function setHeader(PoHeader $header) {
diff --git a/core/modules/locale/src/PoDatabaseWriter.php b/core/modules/locale/src/PoDatabaseWriter.php
index 6763a79e675c..7e7340cf1070 100644
--- a/core/modules/locale/src/PoDatabaseWriter.php
+++ b/core/modules/locale/src/PoDatabaseWriter.php
@@ -154,7 +154,7 @@ public function getHeader() {
    * @param \Drupal\Component\Gettext\PoHeader $header
    *   Header metadata.
    *
-   * @throws Exception
+   * @throws \Exception
    */
   public function setHeader(PoHeader $header) {
     $this->header = $header;
diff --git a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
index 34bf477264e4..c0d317ec467d 100644
--- a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
+++ b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
@@ -332,7 +332,7 @@ public function setMessage(MigrateMessageInterface $message) {
   /**
    * Create the map and message tables if they don't already exist.
    *
-   * @throws \Drupal\Core\Database\DatabaseException
+   * @throws \Drupal\Core\Database\DatabaseExceptionWrapper
    */
   protected function ensureTables() {
     if (!$this->getDatabase()->schema()->tableExists($this->mapTableName)) {
-- 
GitLab