diff --git a/UPGRADE.md b/UPGRADE.md index 9f206c6c809..afb40c7d065 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,12 @@ awareness about deprecated code. # Upgrade to 3.4 +## Deprecated `AbstractPlatform` methods exposing quote characters. + +The `AbstractPlatform::getStringLiteralQuoteCharacter()` and `::getIdentifierQuoteCharacter()` methods +have been deprecated. Use `::quoteStringLiteral()` and `::quoteIdentifier()` to quote string literals and identifiers +respectively. + ## Deprecated `AbstractSchemaManager::getDatabasePlatform()` The `AbstractSchemaManager::getDatabasePlatform()` method has been deprecated. Use `Connection::getDatabasePlatform()` diff --git a/psalm.xml.dist b/psalm.xml.dist index b2d36b3c1d2..ad69d582d25 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -270,6 +270,12 @@ TODO: remove in 4.0.0 --> + + + + diff --git a/src/Platforms/AbstractMySQLPlatform.php b/src/Platforms/AbstractMySQLPlatform.php index 35faf1d850b..e864dcbc052 100644 --- a/src/Platforms/AbstractMySQLPlatform.php +++ b/src/Platforms/AbstractMySQLPlatform.php @@ -65,9 +65,17 @@ protected function doModifyLimitQuery($query, $limit, $offset) /** * {@inheritDoc} + * + * @deprecated Use {@see quoteIdentifier()} to quote identifiers instead. */ public function getIdentifierQuoteCharacter() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5388', + 'AbstractMySQLPlatform::getIdentifierQuoteCharacter() is deprecated. Use quoteIdentifier() instead.' + ); + return '`'; } diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index b2c093c0877..2c64c8bd42a 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -563,10 +563,18 @@ protected function getColumnComment(Column $column) /** * Gets the character used for identifier quoting. * + * @deprecated Use {@see quoteIdentifier()} to quote identifiers instead. + * * @return string */ public function getIdentifierQuoteCharacter() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5388', + 'AbstractPlatform::getIdentifierQuoteCharacter() is deprecated. Use quoteIdentifier() instead.' + ); + return '"'; } @@ -4130,10 +4138,19 @@ public function quoteStringLiteral($str) /** * Gets the character used for string literal quoting. * + * @deprecated Use {@see quoteStringLiteral()} to quote string literals instead. + * * @return string */ public function getStringLiteralQuoteCharacter() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5388', + 'AbstractPlatform::getStringLiteralQuoteCharacter() is deprecated.' + . ' Use quoteStringLiteral() instead.' + ); + return "'"; }