Skip to content

Commit c6be412

Browse files
authored
Merge pull request #5388 from morozov/deprecate-get-quote-character
Deprecate AbstractPlatform methods exposing quote characters
2 parents 7d3351b + 221bd83 commit c6be412

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

UPGRADE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ awareness about deprecated code.
88

99
# Upgrade to 3.4
1010

11+
## Deprecated `AbstractPlatform` methods exposing quote characters.
12+
13+
The `AbstractPlatform::getStringLiteralQuoteCharacter()` and `::getIdentifierQuoteCharacter()` methods
14+
have been deprecated. Use `::quoteStringLiteral()` and `::quoteIdentifier()` to quote string literals and identifiers
15+
respectively.
16+
1117
## Deprecated `AbstractSchemaManager::getDatabasePlatform()`
1218

1319
The `AbstractSchemaManager::getDatabasePlatform()` method has been deprecated. Use `Connection::getDatabasePlatform()`

psalm.xml.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@
270270
TODO: remove in 4.0.0
271271
-->
272272
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getVarcharTypeDeclarationSQL"/>
273+
<!--
274+
TODO: remove in 4.0.0
275+
-->
276+
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractMySQLPlatform::getIdentifierQuoteCharacter"/>
277+
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getIdentifierQuoteCharacter"/>
278+
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getStringLiteralQuoteCharacter"/>
273279
</errorLevel>
274280
</DeprecatedMethod>
275281
<DeprecatedProperty>

src/Platforms/AbstractMySQLPlatform.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,17 @@ protected function doModifyLimitQuery($query, $limit, $offset)
6565

6666
/**
6767
* {@inheritDoc}
68+
*
69+
* @deprecated Use {@see quoteIdentifier()} to quote identifiers instead.
6870
*/
6971
public function getIdentifierQuoteCharacter()
7072
{
73+
Deprecation::triggerIfCalledFromOutside(
74+
'doctrine/dbal',
75+
'https://github.com/doctrine/dbal/pull/5388',
76+
'AbstractMySQLPlatform::getIdentifierQuoteCharacter() is deprecated. Use quoteIdentifier() instead.'
77+
);
78+
7179
return '`';
7280
}
7381

src/Platforms/AbstractPlatform.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,18 @@ protected function getColumnComment(Column $column)
563563
/**
564564
* Gets the character used for identifier quoting.
565565
*
566+
* @deprecated Use {@see quoteIdentifier()} to quote identifiers instead.
567+
*
566568
* @return string
567569
*/
568570
public function getIdentifierQuoteCharacter()
569571
{
572+
Deprecation::triggerIfCalledFromOutside(
573+
'doctrine/dbal',
574+
'https://github.com/doctrine/dbal/pull/5388',
575+
'AbstractPlatform::getIdentifierQuoteCharacter() is deprecated. Use quoteIdentifier() instead.'
576+
);
577+
570578
return '"';
571579
}
572580

@@ -4130,10 +4138,19 @@ public function quoteStringLiteral($str)
41304138
/**
41314139
* Gets the character used for string literal quoting.
41324140
*
4141+
* @deprecated Use {@see quoteStringLiteral()} to quote string literals instead.
4142+
*
41334143
* @return string
41344144
*/
41354145
public function getStringLiteralQuoteCharacter()
41364146
{
4147+
Deprecation::triggerIfCalledFromOutside(
4148+
'doctrine/dbal',
4149+
'https://github.com/doctrine/dbal/pull/5388',
4150+
'AbstractPlatform::getStringLiteralQuoteCharacter() is deprecated.'
4151+
. ' Use quoteStringLiteral() instead.'
4152+
);
4153+
41374154
return "'";
41384155
}
41394156

0 commit comments

Comments
 (0)