Skip to content

Commit

Permalink
Remove AbstractPlatform::hasNative*Type() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Jul 16, 2022
1 parent 1358700 commit 1e49835
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 133 deletions.
2 changes: 2 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down
6 changes: 0 additions & 6 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
See https://github.com/doctrine/dbal/pull/4317
-->
<file name="tests/Functional/LegacyAPITest.php"/>
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::hasNativeGuidType"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::hasNativeJsonType"/>
<referencedMethod name="Doctrine\DBAL\Platforms\PostgreSQLPlatform::hasNativeJsonType"/>
</errorLevel>
</DeprecatedMethod>
<DocblockTypeContradiction>
Expand Down
35 changes: 0 additions & 35 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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?
*/
Expand Down
5 changes: 0 additions & 5 deletions src/Platforms/MySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ public function getDefaultValueDeclarationSQL(array $column): string
return parent::getDefaultValueDeclarationSQL($column);
}

public function hasNativeJsonType(): bool
{
return true;
}

/**
* {@inheritdoc}
*/
Expand Down
31 changes: 0 additions & 31 deletions src/Platforms/PostgreSQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down
16 changes: 0 additions & 16 deletions src/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
20 changes: 0 additions & 20 deletions tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/AbstractPlatformTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/MariaDBPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/MySQLPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([]));
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/PostgreSQLPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([]));
Expand Down

0 comments on commit 1e49835

Please sign in to comment.