From ff2142eab364e8ebadda0024289a61cdeab0b12d Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Wed, 15 Dec 2021 21:01:47 -0800 Subject: [PATCH] Remove AbstractPlatform::prefersIdentityColumns() --- UPGRADE.md | 4 ++++ psalm.xml.dist | 9 --------- src/Platforms/AbstractMySQLPlatform.php | 20 ------------------- src/Platforms/AbstractPlatform.php | 16 --------------- src/Platforms/DB2Platform.php | 15 -------------- src/Platforms/SQLServerPlatform.php | 20 ------------------- src/Platforms/SqlitePlatform.php | 15 -------------- .../AbstractMySQLPlatformTestCase.php | 5 ----- tests/Platforms/DB2PlatformTest.php | 5 ----- tests/Platforms/OraclePlatformTest.php | 5 ----- tests/Platforms/PostgreSQLPlatformTest.php | 5 ----- tests/Platforms/SQLServerPlatformTestCase.php | 5 ----- tests/Platforms/SqlitePlatformTest.php | 5 ----- 13 files changed, 4 insertions(+), 125 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 67d4a37562a..4943d316b2a 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,10 @@ awareness about deprecated code. # Upgrade to 4.0 +## BC BREAK: Removed `AbstractPlatform::prefersIdentityColumns()` + +The `AbstractPlatform::prefersIdentityColumns()` method has been removed. + ## BC BREAK: Removed the `Graphviz` visitor. The `Doctrine\DBAL\Schema\Visitor\Graphviz` class has been removed. diff --git a/psalm.xml.dist b/psalm.xml.dist index 9e918d07a1e..6b1be01aa0b 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -46,15 +46,6 @@ See https://github.com/doctrine/dbal/pull/4317 --> - - - - - - diff --git a/src/Platforms/AbstractMySQLPlatform.php b/src/Platforms/AbstractMySQLPlatform.php index 7281ef4ceb0..3d9d55cf8cf 100644 --- a/src/Platforms/AbstractMySQLPlatform.php +++ b/src/Platforms/AbstractMySQLPlatform.php @@ -15,7 +15,6 @@ use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types\BlobType; use Doctrine\DBAL\Types\TextType; -use Doctrine\Deprecations\Deprecation; use function array_merge; use function array_unique; @@ -223,25 +222,6 @@ public function getBooleanTypeDeclarationSQL(array $column): string return 'TINYINT(1)'; } - /** - * {@inheritDoc} - * - * @deprecated - * - * MySQL prefers "autoincrement" identity columns since sequences can only - * be emulated with a table. - */ - public function prefersIdentityColumns(): bool - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pulls/1519', - 'AbstractMySQLPlatform::prefersIdentityColumns() is deprecated.' - ); - - return true; - } - /** * {@inheritDoc} * diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index 0e83cf67b9c..ef6c38792bf 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -35,7 +35,6 @@ use Doctrine\DBAL\Types; use Doctrine\DBAL\Types\Exception\TypeNotFound; use Doctrine\DBAL\Types\Type; -use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use UnexpectedValueException; @@ -1902,21 +1901,6 @@ public function getColumnCollationDeclarationSQL(string $collation): string return $this->supportsColumnCollation() ? 'COLLATE ' . $collation : ''; } - /** - * Whether the platform prefers identity columns (eg. autoincrement) for ID generation. - * Subclasses should override this method to return TRUE if they prefer identity columns. - */ - public function prefersIdentityColumns(): bool - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pulls/1519', - 'AbstractPlatform::prefersIdentityColumns() is deprecated.' - ); - - return false; - } - /** * Some platforms need the boolean values to be converted. * diff --git a/src/Platforms/DB2Platform.php b/src/Platforms/DB2Platform.php index 9b1a6399974..b1e791b106c 100644 --- a/src/Platforms/DB2Platform.php +++ b/src/Platforms/DB2Platform.php @@ -12,7 +12,6 @@ use Doctrine\DBAL\Schema\Identifier; use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\TableDiff; -use Doctrine\Deprecations\Deprecation; use function array_merge; use function count; @@ -699,20 +698,6 @@ public function supportsIdentityColumns(): bool return true; } - /** - * @deprecated - */ - public function prefersIdentityColumns(): bool - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pulls/1519', - 'DB2Platform::prefersIdentityColumns() is deprecated.' - ); - - return true; - } - public function getForUpdateSQL(): string { return ' WITH RR USE AND KEEP UPDATE LOCKS'; diff --git a/src/Platforms/SQLServerPlatform.php b/src/Platforms/SQLServerPlatform.php index bcded46b418..07230873916 100644 --- a/src/Platforms/SQLServerPlatform.php +++ b/src/Platforms/SQLServerPlatform.php @@ -15,7 +15,6 @@ use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\TableDiff; -use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use function array_merge; @@ -87,25 +86,6 @@ public function getDateDiffExpression(string $date1, string $date2): string return 'DATEDIFF(day, ' . $date2 . ',' . $date1 . ')'; } - /** - * {@inheritDoc} - * - * Microsoft SQL Server prefers "autoincrement" identity columns - * since sequences can only be emulated with a table. - * - * @deprecated - */ - public function prefersIdentityColumns(): bool - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pulls/1519', - 'SQLServerPlatform::prefersIdentityColumns() is deprecated.' - ); - - return true; - } - /** * {@inheritDoc} * diff --git a/src/Platforms/SqlitePlatform.php b/src/Platforms/SqlitePlatform.php index e6eaa7d17ba..af50c46968f 100644 --- a/src/Platforms/SqlitePlatform.php +++ b/src/Platforms/SqlitePlatform.php @@ -16,7 +16,6 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types; -use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use function array_combine; @@ -160,20 +159,6 @@ public function getSetTransactionIsolationSQL(int $level): string return 'PRAGMA read_uncommitted = ' . $this->_getTransactionIsolationLevelSQL($level); } - /** - * @deprecated - */ - public function prefersIdentityColumns(): bool - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pulls/1519', - 'SqlitePlatform::prefersIdentityColumns() is deprecated.' - ); - - return true; - } - /** * {@inheritDoc} */ diff --git a/tests/Platforms/AbstractMySQLPlatformTestCase.php b/tests/Platforms/AbstractMySQLPlatformTestCase.php index 24ae1296240..69e422ed99e 100644 --- a/tests/Platforms/AbstractMySQLPlatformTestCase.php +++ b/tests/Platforms/AbstractMySQLPlatformTestCase.php @@ -127,11 +127,6 @@ public function testGeneratesTypeDeclarationForIntegers(): void ); } - public function testPrefersIdentityColumns(): void - { - self::assertTrue($this->platform->prefersIdentityColumns()); - } - public function testSupportsIdentityColumns(): void { self::assertTrue($this->platform->supportsIdentityColumns()); diff --git a/tests/Platforms/DB2PlatformTest.php b/tests/Platforms/DB2PlatformTest.php index 31fecda248f..5df4ba6bfff 100644 --- a/tests/Platforms/DB2PlatformTest.php +++ b/tests/Platforms/DB2PlatformTest.php @@ -420,11 +420,6 @@ public function testModifiesLimitQuery(): void ); } - public function testPrefersIdentityColumns(): void - { - self::assertTrue($this->platform->prefersIdentityColumns()); - } - public function testSupportsIdentityColumns(): void { self::assertTrue($this->platform->supportsIdentityColumns()); diff --git a/tests/Platforms/OraclePlatformTest.php b/tests/Platforms/OraclePlatformTest.php index 3cf2b6e3267..eecec36bb0d 100644 --- a/tests/Platforms/OraclePlatformTest.php +++ b/tests/Platforms/OraclePlatformTest.php @@ -130,11 +130,6 @@ public function testGeneratesTypeDeclarationForIntegers(): void ); } - public function testPrefersIdentityColumns(): void - { - self::assertFalse($this->platform->prefersIdentityColumns()); - } - public function testSupportsIdentityColumns(): void { self::assertFalse($this->platform->supportsIdentityColumns()); diff --git a/tests/Platforms/PostgreSQLPlatformTest.php b/tests/Platforms/PostgreSQLPlatformTest.php index 2dc96005a41..9820291bc1f 100644 --- a/tests/Platforms/PostgreSQLPlatformTest.php +++ b/tests/Platforms/PostgreSQLPlatformTest.php @@ -309,11 +309,6 @@ public function testGeneratesSequenceSqlCommands(): void ); } - public function testDoesNotPreferIdentityColumns(): void - { - self::assertFalse($this->platform->prefersIdentityColumns()); - } - public function testSupportsIdentityColumns(): void { self::assertTrue($this->platform->supportsIdentityColumns()); diff --git a/tests/Platforms/SQLServerPlatformTestCase.php b/tests/Platforms/SQLServerPlatformTestCase.php index 792be3680cc..94fce2d27d2 100644 --- a/tests/Platforms/SQLServerPlatformTestCase.php +++ b/tests/Platforms/SQLServerPlatformTestCase.php @@ -152,11 +152,6 @@ public function testGeneratesTypeDeclarationsForStrings(): void ); } - public function testPrefersIdentityColumns(): void - { - self::assertTrue($this->platform->prefersIdentityColumns()); - } - public function testSupportsIdentityColumns(): void { self::assertTrue($this->platform->supportsIdentityColumns()); diff --git a/tests/Platforms/SqlitePlatformTest.php b/tests/Platforms/SqlitePlatformTest.php index 7cb5989e5ef..d5c76249dca 100644 --- a/tests/Platforms/SqlitePlatformTest.php +++ b/tests/Platforms/SqlitePlatformTest.php @@ -73,11 +73,6 @@ public function testGeneratesTransactionCommands(): void ); } - public function testPrefersIdentityColumns(): void - { - self::assertTrue($this->platform->prefersIdentityColumns()); - } - public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers(): void { self::assertSame(