From a602f2baf74df3d9b17ea8b29fca5fc33786d68d Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Wed, 31 Mar 2021 20:24:16 -0700 Subject: [PATCH] [GH-4510] Trigger deprecation in AbstractPlatform::getReservedKeywordsClass() implementations --- src/Platforms/AbstractPlatform.php | 7 +++++++ src/Platforms/DB2Platform.php | 8 ++++++++ src/Platforms/MariaDb1027Platform.php | 8 ++++++++ src/Platforms/MySQL57Platform.php | 8 ++++++++ src/Platforms/MySQL80Platform.php | 9 +++++++++ src/Platforms/MySQLPlatform.php | 8 ++++++++ src/Platforms/OraclePlatform.php | 8 ++++++++ src/Platforms/PostgreSQL100Platform.php | 8 ++++++++ src/Platforms/PostgreSQL94Platform.php | 8 ++++++++ src/Platforms/SQLServer2012Platform.php | 8 ++++++++ src/Platforms/SqlitePlatform.php | 8 ++++++++ 11 files changed, 88 insertions(+) diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index 736af53b702..1c9d63c2823 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -3529,6 +3529,13 @@ protected function createReservedKeywordsList(): KeywordList */ protected function getReservedKeywordsClass() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'AbstractPlatform::getReservedKeywordsClass() is deprecated,' + . ' use AbstractPlatform::createReservedKeywordsList() instead.' + ); + throw Exception::notSupported(__METHOD__); } diff --git a/src/Platforms/DB2Platform.php b/src/Platforms/DB2Platform.php index 61a45aa24f8..9d43a0f0c68 100644 --- a/src/Platforms/DB2Platform.php +++ b/src/Platforms/DB2Platform.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; +use Doctrine\Deprecations\Deprecation; use function array_merge; use function count; @@ -901,6 +902,13 @@ public function supportsSavepoints() */ protected function getReservedKeywordsClass() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'DB2Platform::getReservedKeywordsClass() is deprecated,' + . ' use DB2Platform::createReservedKeywordsList() instead.' + ); + return Keywords\DB2Keywords::class; } diff --git a/src/Platforms/MariaDb1027Platform.php b/src/Platforms/MariaDb1027Platform.php index 3ba3b8b04b0..9fa84e98d85 100644 --- a/src/Platforms/MariaDb1027Platform.php +++ b/src/Platforms/MariaDb1027Platform.php @@ -3,6 +3,7 @@ namespace Doctrine\DBAL\Platforms; use Doctrine\DBAL\Types\Types; +use Doctrine\Deprecations\Deprecation; /** * Provides the behavior, features and SQL dialect of the MariaDB 10.2 (10.2.7 GA) database platform. @@ -26,6 +27,13 @@ public function getJsonTypeDeclarationSQL(array $column): string */ protected function getReservedKeywordsClass(): string { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'MariaDb1027Platform::getReservedKeywordsClass() is deprecated,' + . ' use MariaDb1027Platform::createReservedKeywordsList() instead.' + ); + return Keywords\MariaDb102Keywords::class; } diff --git a/src/Platforms/MySQL57Platform.php b/src/Platforms/MySQL57Platform.php index 4d8cf9ca1c6..f29204cf458 100644 --- a/src/Platforms/MySQL57Platform.php +++ b/src/Platforms/MySQL57Platform.php @@ -6,6 +6,7 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\SQL\Parser; use Doctrine\DBAL\Types\Types; +use Doctrine\Deprecations\Deprecation; /** * Provides the behavior, features and SQL dialect of the MySQL 5.7 (5.7.9 GA) database platform. @@ -64,6 +65,13 @@ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) */ protected function getReservedKeywordsClass() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'MySQL57Platform::getReservedKeywordsClass() is deprecated,' + . ' use MySQL57Platform::createReservedKeywordsList() instead.' + ); + return Keywords\MySQL57Keywords::class; } diff --git a/src/Platforms/MySQL80Platform.php b/src/Platforms/MySQL80Platform.php index 258ed7dd9c8..808e9344939 100644 --- a/src/Platforms/MySQL80Platform.php +++ b/src/Platforms/MySQL80Platform.php @@ -2,6 +2,8 @@ namespace Doctrine\DBAL\Platforms; +use Doctrine\Deprecations\Deprecation; + /** * Provides the behavior, features and SQL dialect of the MySQL 8.0 (8.0 GA) database platform. */ @@ -14,6 +16,13 @@ class MySQL80Platform extends MySQL57Platform */ protected function getReservedKeywordsClass() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'MySQL80Platform::getReservedKeywordsClass() is deprecated,' + . ' use MySQL80Platform::createReservedKeywordsList() instead.' + ); + return Keywords\MySQL80Keywords::class; } } diff --git a/src/Platforms/MySQLPlatform.php b/src/Platforms/MySQLPlatform.php index 743c926304f..a8b8756077a 100644 --- a/src/Platforms/MySQLPlatform.php +++ b/src/Platforms/MySQLPlatform.php @@ -11,6 +11,7 @@ use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types\BlobType; use Doctrine\DBAL\Types\TextType; +use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use function array_diff_key; @@ -1110,6 +1111,13 @@ public function getBinaryMaxLength() */ protected function getReservedKeywordsClass() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'MySQLPlatform::getReservedKeywordsClass() is deprecated,' + . ' use MySQLPlatform::createReservedKeywordsList() instead.' + ); + return Keywords\MySQLKeywords::class; } diff --git a/src/Platforms/OraclePlatform.php b/src/Platforms/OraclePlatform.php index 52327c84361..77b573444c0 100644 --- a/src/Platforms/OraclePlatform.php +++ b/src/Platforms/OraclePlatform.php @@ -11,6 +11,7 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types\BinaryType; +use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use function array_merge; @@ -1165,6 +1166,13 @@ public function releaseSavePoint($savepoint) */ protected function getReservedKeywordsClass() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'OraclePlatform::getReservedKeywordsClass() is deprecated,' + . ' use OraclePlatform::createReservedKeywordsList() instead.' + ); + return Keywords\OracleKeywords::class; } diff --git a/src/Platforms/PostgreSQL100Platform.php b/src/Platforms/PostgreSQL100Platform.php index 33589754855..c9ca509d0dd 100644 --- a/src/Platforms/PostgreSQL100Platform.php +++ b/src/Platforms/PostgreSQL100Platform.php @@ -5,6 +5,7 @@ namespace Doctrine\DBAL\Platforms; use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords; +use Doctrine\Deprecations\Deprecation; /** * Provides the behavior, features and SQL dialect of the PostgreSQL 10.0 database platform. @@ -16,6 +17,13 @@ class PostgreSQL100Platform extends PostgreSQL94Platform */ protected function getReservedKeywordsClass(): string { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'PostgreSQL100Platform::getReservedKeywordsClass() is deprecated,' + . ' use PostgreSQL100Platform::createReservedKeywordsList() instead.' + ); + return PostgreSQL100Keywords::class; } diff --git a/src/Platforms/PostgreSQL94Platform.php b/src/Platforms/PostgreSQL94Platform.php index e67bf746280..9649c079701 100644 --- a/src/Platforms/PostgreSQL94Platform.php +++ b/src/Platforms/PostgreSQL94Platform.php @@ -14,6 +14,7 @@ use Doctrine\DBAL\Types\BlobType; use Doctrine\DBAL\Types\IntegerType; use Doctrine\DBAL\Types\Type; +use Doctrine\Deprecations\Deprecation; use UnexpectedValueException; use function array_diff; @@ -1181,6 +1182,13 @@ public function hasNativeJsonType() */ protected function getReservedKeywordsClass() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'PostgreSQL94Platform::getReservedKeywordsClass() is deprecated,' + . ' use PostgreSQL94Platform::createReservedKeywordsList() instead.' + ); + return Keywords\PostgreSQL94Keywords::class; } diff --git a/src/Platforms/SQLServer2012Platform.php b/src/Platforms/SQLServer2012Platform.php index 5fcdf8d1fe6..6ae96143836 100644 --- a/src/Platforms/SQLServer2012Platform.php +++ b/src/Platforms/SQLServer2012Platform.php @@ -12,6 +12,7 @@ use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\TableDiff; +use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use function array_merge; @@ -1561,6 +1562,13 @@ public function getForUpdateSQL() */ protected function getReservedKeywordsClass() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'QLServer2012Platform::getReservedKeywordsClass() is deprecated,' + . ' use QLServer2012Platform::createReservedKeywordsList() instead.' + ); + return Keywords\SQLServer2012Keywords::class; } diff --git a/src/Platforms/SqlitePlatform.php b/src/Platforms/SqlitePlatform.php index 672496cc3d8..90defce40ba 100644 --- a/src/Platforms/SqlitePlatform.php +++ b/src/Platforms/SqlitePlatform.php @@ -11,6 +11,7 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types; +use Doctrine\Deprecations\Deprecation; use function array_merge; use function array_unique; @@ -689,6 +690,13 @@ protected function initializeDoctrineTypeMappings() */ protected function getReservedKeywordsClass() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'SqlitePlatform::getReservedKeywordsClass() is deprecated,' + . ' use SqlitePlatform::createReservedKeywordsList() instead.' + ); + return Keywords\SQLiteKeywords::class; }