From ac58f3561686803822e392f456de0a4d9d8d604d Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sat, 16 Jul 2022 08:46:03 -0700 Subject: [PATCH] Remove SqlitePlatform::getTinyIntTypeDeclarationSQL() and ::getMediumIntTypeDeclarationSQL() --- UPGRADE.md | 5 +++ psalm.xml.dist | 5 --- src/Platforms/SqlitePlatform.php | 45 ------------------- tests/Platforms/SqlitePlatformTest.php | 60 -------------------------- 4 files changed, 5 insertions(+), 110 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 6f60d546fbe..a0f3fbee3d1 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,11 @@ awareness about deprecated code. # Upgrade to 4.0 +## BC BREAK: removed `SqlitePlatform` methods. + +1. `getTinyIntTypeDeclarationSQL()`, +2. `getMediumIntTypeDeclarationSQL()`. + ## BC BREAK: removed `AbstractPlatform` methods. 1. `getDefaultSchemaName()`, diff --git a/psalm.xml.dist b/psalm.xml.dist index d704819f79a..0cd277d5ace 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -39,11 +39,6 @@ See https://github.com/doctrine/dbal/pull/4317 --> - - - diff --git a/src/Platforms/SqlitePlatform.php b/src/Platforms/SqlitePlatform.php index ca5c7622adf..b555b3c4e1b 100644 --- a/src/Platforms/SqlitePlatform.php +++ b/src/Platforms/SqlitePlatform.php @@ -19,7 +19,6 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types; -use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use function array_combine; @@ -208,28 +207,6 @@ public function getBigIntTypeDeclarationSQL(array $column): string return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); } - /** - * @deprecated Use {@see getSmallIntTypeDeclarationSQL()} instead. - * - * @param array $column - */ - public function getTinyIntTypeDeclarationSQL(array $column): string - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/5511', - '%s is deprecated. Use getSmallIntTypeDeclarationSQL() instead.', - __METHOD__ - ); - - // SQLite autoincrement is implicit for INTEGER PKs, but not for TINYINT columns - if (! empty($column['autoincrement'])) { - return $this->getIntegerTypeDeclarationSQL($column); - } - - return 'TINYINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - /** * {@inheritDoc} */ @@ -243,28 +220,6 @@ public function getSmallIntTypeDeclarationSQL(array $column): string return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); } - /** - * @deprecated Use {@see getIntegerTypeDeclarationSQL()} instead. - * - * @param array $column - */ - public function getMediumIntTypeDeclarationSQL(array $column): string - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/5511', - '%s is deprecated. Use getIntegerTypeDeclarationSQL() instead.', - __METHOD__ - ); - - // SQLite autoincrement is implicit for INTEGER PKs, but not for MEDIUMINT columns - if (! empty($column['autoincrement'])) { - return $this->getIntegerTypeDeclarationSQL($column); - } - - return 'MEDIUMINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - /** * {@inheritDoc} */ diff --git a/tests/Platforms/SqlitePlatformTest.php b/tests/Platforms/SqlitePlatformTest.php index 36d269c2677..4c94e0982da 100644 --- a/tests/Platforms/SqlitePlatformTest.php +++ b/tests/Platforms/SqlitePlatformTest.php @@ -81,32 +81,6 @@ public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers( ); } - public function testGeneratesTypeDeclarationForTinyIntegers(): void - { - self::assertEquals( - 'TINYINT', - $this->platform->getTinyIntTypeDeclarationSQL([]) - ); - self::assertEquals( - 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getTinyIntTypeDeclarationSQL(['autoincrement' => true]) - ); - self::assertEquals( - 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getTinyIntTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) - ); - self::assertEquals( - 'TINYINT', - $this->platform->getTinyIntTypeDeclarationSQL(['unsigned' => false]) - ); - self::assertEquals( - 'TINYINT UNSIGNED', - $this->platform->getTinyIntTypeDeclarationSQL(['unsigned' => true]) - ); - } - public function testGeneratesTypeDeclarationForSmallIntegers(): void { self::assertEquals( @@ -117,10 +91,6 @@ public function testGeneratesTypeDeclarationForSmallIntegers(): void 'INTEGER PRIMARY KEY AUTOINCREMENT', $this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true]) ); - self::assertEquals( - 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getTinyIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]) - ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', $this->platform->getSmallIntTypeDeclarationSQL( @@ -137,36 +107,6 @@ public function testGeneratesTypeDeclarationForSmallIntegers(): void ); } - public function testGeneratesTypeDeclarationForMediumIntegers(): void - { - self::assertEquals( - 'MEDIUMINT', - $this->platform->getMediumIntTypeDeclarationSQL([]) - ); - self::assertEquals( - 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getMediumIntTypeDeclarationSQL(['autoincrement' => true]) - ); - self::assertEquals( - 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getMediumIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]) - ); - self::assertEquals( - 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getMediumIntTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) - ); - self::assertEquals( - 'MEDIUMINT', - $this->platform->getMediumIntTypeDeclarationSQL(['unsigned' => false]) - ); - self::assertEquals( - 'MEDIUMINT UNSIGNED', - $this->platform->getMediumIntTypeDeclarationSQL(['unsigned' => true]) - ); - } - public function testGeneratesTypeDeclarationForIntegers(): void { self::assertEquals(