From 1e4983523b39bfa60531213a6ee47e033ae2fac5 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Fri, 15 Jul 2022 17:17:18 -0700 Subject: [PATCH] Remove AbstractPlatform::hasNative*Type() methods --- UPGRADE.md | 2 ++ psalm.xml.dist | 6 ---- src/Platforms/AbstractPlatform.php | 35 ------------------- src/Platforms/MySQLPlatform.php | 5 --- src/Platforms/PostgreSQLPlatform.php | 31 ---------------- src/Platforms/SQLServerPlatform.php | 16 --------- .../SchemaManagerFunctionalTestCase.php | 20 ----------- tests/Platforms/AbstractPlatformTestCase.php | 5 --- tests/Platforms/MariaDBPlatformTest.php | 5 --- tests/Platforms/MySQLPlatformTest.php | 5 --- tests/Platforms/PostgreSQLPlatformTest.php | 5 --- 11 files changed, 2 insertions(+), 133 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index a120b08e927..53946d926aa 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -211,6 +211,8 @@ Postgres 9 is not actively supported anymore. The following classes have been me The following methods are removed: +- `AbstractPlatform::hasNativeJsonType()` +- `AbstractPlatform::hasNativeGuidType()` - `AbstractPlatform::isCommentedDoctrineType()` - `AbstractPlatform::initializeCommentedDoctrineTypes()` - `AbstractPlatform::markDoctrineTypeCommented()` diff --git a/psalm.xml.dist b/psalm.xml.dist index d03bd247af1..0cd277d5ace 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -39,12 +39,6 @@ See https://github.com/doctrine/dbal/pull/4317 --> - - - - diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index c48dc766c10..3b0b3e24bda 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -37,7 +37,6 @@ use Doctrine\DBAL\Types; use Doctrine\DBAL\Types\Exception\TypeNotFound; use Doctrine\DBAL\Types\Type; -use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use UnexpectedValueException; @@ -2286,40 +2285,6 @@ public function supportsCommentOnStatement(): bool return false; } - /** - * Does this platform have native guid type. - * - * @deprecated - */ - public function hasNativeGuidType(): bool - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/5509', - '%s is deprecated.', - __METHOD__ - ); - - return false; - } - - /** - * Does this platform have native JSON type. - * - * @deprecated - */ - public function hasNativeJsonType(): bool - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/5509', - '%s is deprecated.', - __METHOD__ - ); - - return false; - } - /** * Does this platform support column collation? */ diff --git a/src/Platforms/MySQLPlatform.php b/src/Platforms/MySQLPlatform.php index 5fb7f41ccf8..0ae96073217 100644 --- a/src/Platforms/MySQLPlatform.php +++ b/src/Platforms/MySQLPlatform.php @@ -32,11 +32,6 @@ public function getDefaultValueDeclarationSQL(array $column): string return parent::getDefaultValueDeclarationSQL($column); } - public function hasNativeJsonType(): bool - { - return true; - } - /** * {@inheritdoc} */ diff --git a/src/Platforms/PostgreSQLPlatform.php b/src/Platforms/PostgreSQLPlatform.php index 09f26a5d9cc..f73386a92f9 100644 --- a/src/Platforms/PostgreSQLPlatform.php +++ b/src/Platforms/PostgreSQLPlatform.php @@ -16,7 +16,6 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Types\BinaryType; use Doctrine\DBAL\Types\BlobType; -use Doctrine\Deprecations\Deprecation; use UnexpectedValueException; use function array_diff; @@ -155,21 +154,6 @@ public function supportsCommentOnStatement(): bool return true; } - /** - * @deprecated - */ - public function hasNativeGuidType(): bool - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/5509', - '%s is deprecated.', - __METHOD__ - ); - - return true; - } - public function getListDatabasesSQL(): string { return 'SELECT datname FROM pg_database'; @@ -823,21 +807,6 @@ protected function initializeDoctrineTypeMappings(): void ]; } - /** - * @deprecated - */ - public function hasNativeJsonType(): bool - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/5509', - '%s is deprecated.', - __METHOD__ - ); - - return true; - } - protected function createReservedKeywordsList(): KeywordList { return new PostgreSQLKeywords(); diff --git a/src/Platforms/SQLServerPlatform.php b/src/Platforms/SQLServerPlatform.php index 3c5ab830057..e328e3e8716 100644 --- a/src/Platforms/SQLServerPlatform.php +++ b/src/Platforms/SQLServerPlatform.php @@ -17,7 +17,6 @@ use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\SQLServerSchemaManager; use Doctrine\DBAL\Schema\TableDiff; -use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use function array_merge; @@ -155,21 +154,6 @@ public function getSequenceNextValSQL(string $sequence): string return 'SELECT NEXT VALUE FOR ' . $sequence; } - /** - * @deprecated - */ - public function hasNativeGuidType(): bool - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/5509', - '%s is deprecated.', - __METHOD__ - ); - - return true; - } - public function getDropForeignKeySQL(string $foreignKey, string $table): string { return $this->getDropConstraintSQL($foreignKey, $table); diff --git a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php index d67b802e1d9..fa84613c888 100644 --- a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -1116,26 +1116,6 @@ public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys(): void self::assertArrayHasKey('idx_3d6c147fdc58d6c', $indexes); } - public function testComparatorShouldNotAddCommentToJsonTypeSinceItIsTheDefaultNow(): void - { - $platform = $this->connection->getDatabasePlatform(); - - if (! $platform->hasNativeJsonType()) { - self::markTestSkipped('This test is only supported on platforms that have native JSON type.'); - } - - $this->dropTableIfExists('json_test'); - $this->connection->executeQuery('CREATE TABLE json_test (parameters JSON NOT NULL)'); - - $table = new Table('json_test'); - $table->addColumn('parameters', 'json'); - - $tableDiff = $this->schemaManager->createComparator() - ->diffTable($this->schemaManager->listTableDetails('json_test'), $table); - - self::assertNull($tableDiff); - } - public function testCreateAndListSequences(): void { if (! $this->connection->getDatabasePlatform()->supportsSequences()) { diff --git a/tests/Platforms/AbstractPlatformTestCase.php b/tests/Platforms/AbstractPlatformTestCase.php index aa344416316..1efd3f68697 100644 --- a/tests/Platforms/AbstractPlatformTestCase.php +++ b/tests/Platforms/AbstractPlatformTestCase.php @@ -817,11 +817,6 @@ public function getExpectedVariableLengthBinaryTypeDeclarationSQLWithLength(): s return 'VARBINARY(16)'; } - public function hasNativeJsonType(): void - { - self::assertFalse($this->platform->hasNativeJsonType()); - } - public function testReturnsJsonTypeDeclarationSQL(): void { $column = [ diff --git a/tests/Platforms/MariaDBPlatformTest.php b/tests/Platforms/MariaDBPlatformTest.php index bcc8fe953c6..1df589c14cc 100644 --- a/tests/Platforms/MariaDBPlatformTest.php +++ b/tests/Platforms/MariaDBPlatformTest.php @@ -15,11 +15,6 @@ public function createPlatform(): AbstractPlatform return new MariaDBPlatform(); } - public function testHasNativeJsonType(): void - { - self::assertFalse($this->platform->hasNativeJsonType()); - } - /** * From MariaDB 10.2.7, JSON type is an alias to LONGTEXT * diff --git a/tests/Platforms/MySQLPlatformTest.php b/tests/Platforms/MySQLPlatformTest.php index 506d4d177f7..56ae4840a16 100644 --- a/tests/Platforms/MySQLPlatformTest.php +++ b/tests/Platforms/MySQLPlatformTest.php @@ -20,11 +20,6 @@ public function createPlatform(): AbstractPlatform return new MySQLPlatform(); } - public function testHasNativeJsonType(): void - { - self::assertTrue($this->platform->hasNativeJsonType()); - } - public function testReturnsJsonTypeDeclarationSQL(): void { self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL([])); diff --git a/tests/Platforms/PostgreSQLPlatformTest.php b/tests/Platforms/PostgreSQLPlatformTest.php index 999e7983725..a426c026b85 100644 --- a/tests/Platforms/PostgreSQLPlatformTest.php +++ b/tests/Platforms/PostgreSQLPlatformTest.php @@ -897,11 +897,6 @@ public function testColumnCollationDeclarationSQL(): void ); } - public function testHasNativeJsonType(): void - { - self::assertTrue($this->platform->hasNativeJsonType()); - } - public function testReturnsJsonTypeDeclarationSQL(): void { self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL([]));