From b1770c7b3051cd7134af1633ee1e20bfcd1874f4 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 3 Nov 2024 08:19:02 -0800 Subject: [PATCH 1/2] Remove AbstractPlatform constants --- UPGRADE.md | 4 ++++ src/Platforms/AbstractPlatform.php | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 6e606beefd..c54dab4c69 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,10 @@ awareness about deprecated code. # Upgrade to 5.0 +## BC BREAK: Removed `AbstractPlatform` constants + +The `CREATE_INDEXES` and `CREATE_FOREIGNKEYS` constants have been removed from the `AbstractPlatform` class. + ## BC BREAK: Add `Result::getColumnName()` A new method `getColumnName()` has been added to the `Result` interface and must be implemented by diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index 53b71a8dcd..6c1bf1cf5b 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -72,12 +72,6 @@ */ abstract class AbstractPlatform { - /** @deprecated */ - public const CREATE_INDEXES = 1; - - /** @deprecated */ - public const CREATE_FOREIGNKEYS = 2; - /** @var string[]|null */ protected ?array $doctrineTypeMapping = null; From f9b579ab49b16d910311a6594b7f73d459220623 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 3 Nov 2024 08:27:44 -0800 Subject: [PATCH 2/2] Removed Table::removeForeignKey() and ::removeUniqueConstraint() --- UPGRADE.md | 4 +++ psalm.xml.dist | 7 ----- src/Schema/Table.php | 32 --------------------- tests/Schema/AbstractComparatorTestCase.php | 2 +- tests/Schema/TableTest.php | 10 +++---- 5 files changed, 10 insertions(+), 45 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index c54dab4c69..624008eb20 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,10 @@ awareness about deprecated code. # Upgrade to 5.0 +## BC BREAK: Removed `Table::removeForeignKey()` and `::removeUniqueConstraint()` + +The `Table::removeForeignKey()` and `::removeUniqueConstraint()` have been removed. + ## BC BREAK: Removed `AbstractPlatform` constants The `CREATE_INDEXES` and `CREATE_FOREIGNKEYS` constants have been removed from the `AbstractPlatform` class. diff --git a/psalm.xml.dist b/psalm.xml.dist index 38b08bf5cb..b5358bb294 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -55,13 +55,6 @@ - - - - diff --git a/src/Schema/Table.php b/src/Schema/Table.php index b6deec7348..851a43651b 100644 --- a/src/Schema/Table.php +++ b/src/Schema/Table.php @@ -436,22 +436,6 @@ public function getForeignKey(string $name): ForeignKeyConstraint return $this->_fkConstraints[$name]; } - /** - * Removes the foreign key constraint with the given name. - * - * @deprecated Use {@link dropForeignKey()} instead. - */ - public function removeForeignKey(string $name): void - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/6560', - 'Table::removeForeignKey() is deprecated. Use Table::removeForeignKey() instead.', - ); - - $this->dropForeignKey($name); - } - /** * Drops the foreign key constraint with the given name. */ @@ -490,22 +474,6 @@ public function getUniqueConstraint(string $name): UniqueConstraint return $this->uniqueConstraints[$name]; } - /** - * Removes the unique constraint with the given name. - * - * @deprecated Use {@link dropUniqueConstraint()} instead. - */ - public function removeUniqueConstraint(string $name): void - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/6560', - 'Table::removeUniqueConstraint() is deprecated. Use Table::dropUniqueConstraint() instead.', - ); - - $this->dropUniqueConstraint($name); - } - /** * Drops the unique constraint with the given name. */ diff --git a/tests/Schema/AbstractComparatorTestCase.php b/tests/Schema/AbstractComparatorTestCase.php index f698ea3f3e..e982595a0e 100644 --- a/tests/Schema/AbstractComparatorTestCase.php +++ b/tests/Schema/AbstractComparatorTestCase.php @@ -244,7 +244,7 @@ public function testTableAddForeignKey(): void self::assertCount(1, $tableDiff->getAddedForeignKeys()); } - public function testTableRemoveForeignKey(): void + public function testTableDropForeignKey(): void { $tableForeign = new Table('bar'); $tableForeign->addColumn('id', Types::INTEGER); diff --git a/tests/Schema/TableTest.php b/tests/Schema/TableTest.php index 035313bb6d..f1fe2f5cbb 100644 --- a/tests/Schema/TableTest.php +++ b/tests/Schema/TableTest.php @@ -855,7 +855,7 @@ public function testNormalizesColumnNames(string $assetName): void $table->dropColumn($assetName); $table->dropIndex($assetName); - $table->removeForeignKey($assetName); + $table->dropForeignKey($assetName); self::assertFalse($table->hasColumn($assetName)); self::assertFalse($table->hasColumn('foo')); @@ -918,25 +918,25 @@ public function testUniqueConstraintWithEmptyName(): void self::assertSame($uniqueConstraints[1], $constraints['fk_d87f7e0cda12812744761484']); } - public function testRemoveUniqueConstraint(): void + public function testDropUniqueConstraint(): void { $table = new Table('foo'); $table->addColumn('bar', Types::INTEGER); $table->addUniqueConstraint(['bar'], 'unique_constraint'); - $table->removeUniqueConstraint('unique_constraint'); + $table->dropUniqueConstraint('unique_constraint'); self::assertFalse($table->hasUniqueConstraint('unique_constraint')); } - public function testRemoveUniqueConstraintUnknownNameThrowsException(): void + public function testDropUniqueConstraintUnknownNameThrowsException(): void { $this->expectException(SchemaException::class); $table = new Table('foo'); $table->addColumn('bar', Types::INTEGER); - $table->removeUniqueConstraint('unique_constraint'); + $table->dropUniqueConstraint('unique_constraint'); } public function testDropColumnWithForeignKeyConstraint(): void