diff --git a/UPGRADE.md b/UPGRADE.md index d23c9abd00f..c7f49214144 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -109,6 +109,8 @@ an exception. The characters are the following: `{}()/\@`. The `SQLLogger` and its implementations `DebugStack` and `LoggerChain` have been deprecated. For logging purposes, use `Doctrine\DBAL\Logging\Middleware` instead. No replacement for `DebugStack` is provided. +The `Configuration` methods `getSQLLogger()` and `setSQLLogger()` have been deprecated as well. + ## Deprecated `SqliteSchemaManager::createDatabase()` and `dropDatabase()` methods. The `SqliteSchemaManager::createDatabase()` and `dropDatabase()` methods have been deprecated. The SQLite engine diff --git a/psalm.xml.dist b/psalm.xml.dist index 88c48eaabbe..248c10d843b 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -225,6 +225,12 @@ See https://github.com/doctrine/dbal/pull/5136 --> + + + diff --git a/src/Configuration.php b/src/Configuration.php index 2d27d733b86..8d46a47d132 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -57,17 +57,35 @@ class Configuration /** * Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled. + * + * @deprecated Use {@see setMiddlewares()} and {@see \Doctrine\DBAL\Logging\Middleware} instead. */ public function setSQLLogger(?SQLLogger $logger = null): void { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4967', + '%s is deprecated, use setMiddlewares() and Logging\\Middleware instead.', + __METHOD__ + ); + $this->sqlLogger = $logger; } /** * Gets the SQL logger that is used. + * + * @deprecated */ public function getSQLLogger(): ?SQLLogger { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4967', + '%s is deprecated.', + __METHOD__ + ); + return $this->sqlLogger; }