diff --git a/UPGRADE.md b/UPGRADE.md index a0a7327e6e8..955216026f1 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,14 @@ awareness about deprecated code. # Upgrade to 3.2 +## Deprecated schema methods related to explicit foreign key indexes. + +The following methods have been deprecated: + +- `Schema::hasExplicitForeignKeyIndexes()`, +- `SchemaConfig::hasExplicitForeignKeyIndexes()`, +- `SchemaConfig::setExplicitForeignKeyIndexes()`. + ## Deprecated `Schema::getTableNames()`. The `Schema::getTableNames()` method has been deprecated. In order to obtain schema table names, diff --git a/psalm.xml.dist b/psalm.xml.dist index a0099aad042..0b178cce843 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -154,6 +154,11 @@ TODO: remove in 4.0.0 --> + + @@ -169,6 +174,11 @@ See https://github.com/doctrine/dbal/pull/4620 --> + + diff --git a/src/Schema/Schema.php b/src/Schema/Schema.php index fe7186fd499..90051480ea4 100644 --- a/src/Schema/Schema.php +++ b/src/Schema/Schema.php @@ -89,10 +89,18 @@ public function __construct( } /** + * @deprecated + * * @return bool */ public function hasExplicitForeignKeyIndexes() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4822', + 'Schema::hasExplicitForeignKeyIndexes() is deprecated.' + ); + return $this->_schemaConfig->hasExplicitForeignKeyIndexes(); } diff --git a/src/Schema/SchemaConfig.php b/src/Schema/SchemaConfig.php index 56d49c4a798..92e0701f075 100644 --- a/src/Schema/SchemaConfig.php +++ b/src/Schema/SchemaConfig.php @@ -2,12 +2,18 @@ namespace Doctrine\DBAL\Schema; +use Doctrine\Deprecations\Deprecation; + /** * Configuration for a Schema. */ class SchemaConfig { - /** @var bool */ + /** + * @deprecated + * + * @var bool + */ protected $hasExplicitForeignKeyIndexes = false; /** @var int */ @@ -20,20 +26,36 @@ class SchemaConfig protected $defaultTableOptions = []; /** + * @deprecated + * * @return bool */ public function hasExplicitForeignKeyIndexes() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4822', + 'SchemaConfig::hasExplicitForeignKeyIndexes() is deprecated.' + ); + return $this->hasExplicitForeignKeyIndexes; } /** + * @deprecated + * * @param bool $flag * * @return void */ public function setExplicitForeignKeyIndexes($flag) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4822', + 'SchemaConfig::setExplicitForeignKeyIndexes() is deprecated.' + ); + $this->hasExplicitForeignKeyIndexes = (bool) $flag; }