Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate AbstractPlatform methods exposing quote characters #5388

Merged
merged 1 commit into from
May 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down
6 changes: 6 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getVarcharTypeDeclarationSQL"/>
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractMySQLPlatform::getIdentifierQuoteCharacter"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getIdentifierQuoteCharacter"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getStringLiteralQuoteCharacter"/>
</errorLevel>
</DeprecatedMethod>
<DeprecatedProperty>
Expand Down
8 changes: 8 additions & 0 deletions src/Platforms/AbstractMySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '`';
}

Expand Down
17 changes: 17 additions & 0 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '"';
}

Expand Down Expand Up @@ -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 "'";
}

Expand Down