diff --git a/UPGRADE.md b/UPGRADE.md
index d3ed5027120..ffd27c19dc2 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -1,5 +1,20 @@
# Upgrade to 4.0
+## `PostgreSQLSchemaManager` methods have been made protected.
+
+`PostgreSQLSchemaManager::getExistingSchemaSearchPaths()` and `::determineExistingSchemaSearchPaths()` have been made protected.
+The former has also been made final.
+
+## Removed schema- and namespace-related methods
+
+The following schema- and namespace-related methods have been removed:
+
+- `AbstractPlatform::getListNamespacesSQL()`,
+- `AbstractSchemaManager::listNamespaceNames()`,
+- `AbstractSchemaManager::getPortableNamespacesList()`,
+- `AbstractSchemaManager::getPortableNamespaceDefinition()`,
+- `PostgreSQLSchemaManager::getSchemaNames()`.
+
## Removed the `$driverOptions` argument of `PDO\Statement::bindParam()` and `PDO\SQLSrv\Statement::bindParam()`
The `$driverOptions` argument of `PDO\Statement::bindParam()` and `PDO\SQLSrv\Statement::bindParam()` has been removed. The specifics of binding a parameter to the statement should be specified using the `$type` argument.
diff --git a/psalm.xml.dist b/psalm.xml.dist
index 6a0f40d82d0..dcd79ac15a8 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -59,15 +59,6 @@
See https://github.com/doctrine/dbal/issues/4510
-->
-
-
-
-
-
-
@@ -125,12 +116,6 @@
-
-
-
-
-
-
@@ -143,8 +128,6 @@
Fixing this issue requires an API change
-->
-
-
diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php
index f1fd939a12c..9e262b3f4ac 100644
--- a/src/Platforms/AbstractPlatform.php
+++ b/src/Platforms/AbstractPlatform.php
@@ -2505,25 +2505,6 @@ public function getListDatabasesSQL(): string
throw NotSupported::new(__METHOD__);
}
- /**
- * Returns the SQL statement for retrieving the namespaces defined in the database.
- *
- * @deprecated Use {@link AbstractSchemaManager::listSchemaNames()} instead.
- *
- * @throws Exception If not supported on this platform.
- */
- public function getListNamespacesSQL(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/issues/4503',
- 'AbstractPlatform::getListNamespacesSQL() is deprecated,'
- . ' use AbstractSchemaManager::listSchemaNames() instead.'
- );
-
- throw NotSupported::new(__METHOD__);
- }
-
/**
* @throws Exception If not supported on this platform.
*/
diff --git a/src/Platforms/PostgreSQL94Platform.php b/src/Platforms/PostgreSQL94Platform.php
index e6ed2efe0ba..592bae551e7 100644
--- a/src/Platforms/PostgreSQL94Platform.php
+++ b/src/Platforms/PostgreSQL94Platform.php
@@ -170,24 +170,6 @@ public function getListDatabasesSQL(): string
return 'SELECT datname FROM pg_database';
}
- /**
- * @deprecated Use {@link PostgreSQLSchemaManager::listSchemaNames()} instead.
- */
- public function getListNamespacesSQL(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/issues/4503',
- 'PostgreSQL94Platform::getListNamespacesSQL() is deprecated,'
- . ' use PostgreSQLSchemaManager::listSchemaNames() instead.'
- );
-
- return "SELECT schema_name AS nspname
- FROM information_schema.schemata
- WHERE schema_name NOT LIKE 'pg\_%'
- AND schema_name != 'information_schema'";
- }
-
public function getListSequencesSQL(string $database): string
{
return "SELECT sequence_name AS relname,
diff --git a/src/Platforms/SQLServer2012Platform.php b/src/Platforms/SQLServer2012Platform.php
index 4325d14c45a..22fcda1b9d3 100644
--- a/src/Platforms/SQLServer2012Platform.php
+++ b/src/Platforms/SQLServer2012Platform.php
@@ -1050,21 +1050,6 @@ public function getListDatabasesSQL(): string
return 'SELECT * FROM sys.databases';
}
- /**
- * @deprecated Use {@link SQLServerSchemaManager::listSchemaNames()} instead.
- */
- public function getListNamespacesSQL(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/issues/4503',
- 'SQLServer2012Platform::getListNamespacesSQL() is deprecated,'
- . ' use SQLServerSchemaManager::listSchemaNames() instead.'
- );
-
- return "SELECT name FROM sys.schemas WHERE name NOT IN('guest', 'INFORMATION_SCHEMA', 'sys')";
- }
-
public function getSubstringExpression(string $string, string $start, ?string $length = null): string
{
if ($length === null) {
diff --git a/src/Schema/AbstractSchemaManager.php b/src/Schema/AbstractSchemaManager.php
index 55309a96c90..ac194b2241e 100644
--- a/src/Schema/AbstractSchemaManager.php
+++ b/src/Schema/AbstractSchemaManager.php
@@ -12,7 +12,6 @@
use Doctrine\DBAL\Exception\DatabaseRequired;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\Exception\NotSupported;
-use Doctrine\Deprecations\Deprecation;
use Throwable;
use function array_filter;
@@ -98,31 +97,6 @@ public function listDatabases(): array
return $this->_getPortableDatabasesList($databases);
}
- /**
- * Returns a list of all namespaces in the current database.
- *
- * @deprecated Use {@link listSchemaNames()} instead.
- *
- * @return array
- *
- * @throws Exception
- */
- public function listNamespaceNames(): array
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/issues/4503',
- 'AbstractSchemaManager::listNamespaceNames() is deprecated,'
- . ' use AbstractSchemaManager::listSchemaNames() instead.'
- );
-
- $sql = $this->_platform->getListNamespacesSQL();
-
- $namespaces = $this->_conn->fetchAllAssociative($sql);
-
- return $this->getPortableNamespacesList($namespaces);
- }
-
/**
* Returns a list of the names of all schemata in the current database.
*
@@ -643,34 +617,6 @@ protected function _getPortableDatabasesList(array $databases): array
return $list;
}
- /**
- * Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition.
- *
- * @deprecated Use {@link listSchemaNames()} instead.
- *
- * @param array> $namespaces The list of namespace names
- * in the native DBMS data definition.
- *
- * @return array
- */
- protected function getPortableNamespacesList(array $namespaces): array
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/issues/4503',
- 'AbstractSchemaManager::getPortableNamespacesList() is deprecated,'
- . ' use AbstractSchemaManager::listSchemaNames() instead.'
- );
-
- $namespacesList = [];
-
- foreach ($namespaces as $namespace) {
- $namespacesList[] = $this->getPortableNamespaceDefinition($namespace);
- }
-
- return $namespacesList;
- }
-
/**
* @param array $database
*/
@@ -681,18 +627,6 @@ protected function _getPortableDatabaseDefinition(array $database): string
return array_shift($database);
}
- /**
- * Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition.
- *
- * @deprecated Use {@link listSchemaNames()} instead.
- *
- * @param array $namespace The native DBMS namespace definition.
- */
- protected function getPortableNamespaceDefinition(array $namespace): string
- {
- return array_shift($namespace);
- }
-
/**
* @param array> $sequences
*
@@ -973,7 +907,7 @@ public function createSchema(): Schema
$schemaNames = [];
if ($this->_platform->supportsSchemas()) {
- $schemaNames = $this->listNamespaceNames();
+ $schemaNames = $this->listSchemaNames();
}
$sequences = [];
diff --git a/src/Schema/PostgreSQLSchemaManager.php b/src/Schema/PostgreSQLSchemaManager.php
index aea82b64eb9..a89bd76bfb1 100644
--- a/src/Schema/PostgreSQLSchemaManager.php
+++ b/src/Schema/PostgreSQLSchemaManager.php
@@ -8,7 +8,6 @@
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
-use Doctrine\Deprecations\Deprecation;
use function array_change_key_case;
use function array_filter;
@@ -37,27 +36,6 @@ class PostgreSQLSchemaManager extends AbstractSchemaManager
/** @var array|null */
private $existingSchemaPaths;
- /**
- * Gets all the existing schema names.
- *
- * @deprecated Use {@link listSchemaNames()} instead.
- *
- * @return array
- *
- * @throws Exception
- */
- public function getSchemaNames(): array
- {
- Deprecation::trigger(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/issues/4503',
- 'PostgreSQLSchemaManager::getSchemaNames() is deprecated,'
- . ' use PostgreSQLSchemaManager::listSchemaNames() instead.'
- );
-
- return $this->listNamespaceNames();
- }
-
/**
* {@inheritDoc}
*/
@@ -93,36 +71,34 @@ public function getSchemaSearchPaths(): array
}
/**
- * Gets names of all existing schemas in the current users search path.
- *
- * This is a PostgreSQL only function.
- *
- * @internal The method should be only used from within the PostgreSQLSchemaManager class hierarchy.
+ * Gets names of all existing schemas in the current user's search path.
*
* @return array
+ *
+ * @throws Exception
*/
- public function getExistingSchemaSearchPaths(): array
+ final protected function getExistingSchemaSearchPaths(): array
{
if ($this->existingSchemaPaths === null) {
- $this->determineExistingSchemaSearchPaths();
+ $this->existingSchemaPaths = $this->determineExistingSchemaSearchPaths();
}
return $this->existingSchemaPaths;
}
/**
- * Sets or resets the order of the existing schemas in the current search path of the user.
+ * Determines the names of all existing schemas in the current user's search path.
*
- * This is a PostgreSQL only function.
+ * @return array
*
- * @internal The method should be only used from within the PostgreSQLSchemaManager class hierarchy.
+ * @throws Exception
*/
- public function determineExistingSchemaSearchPaths(): void
+ protected function determineExistingSchemaSearchPaths(): array
{
$names = $this->listSchemaNames();
$paths = $this->getSchemaSearchPaths();
- $this->existingSchemaPaths = array_filter($paths, static function ($v) use ($names): bool {
+ return array_filter($paths, static function ($v) use ($names): bool {
return in_array($v, $names, true);
});
}
@@ -283,23 +259,6 @@ protected function _getPortableSequencesList(array $sequences): array
return $list;
}
- /**
- * {@inheritdoc}
- *
- * @deprecated Use {@link listSchemaNames()} instead.
- */
- protected function getPortableNamespaceDefinition(array $namespace): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/issues/4503',
- 'PostgreSQLSchemaManager::getPortableNamespaceDefinition() is deprecated,'
- . ' use PostgreSQLSchemaManager::listSchemaNames() instead.'
- );
-
- return $namespace['nspname'];
- }
-
/**
* {@inheritdoc}
*/
diff --git a/src/Schema/SQLServerSchemaManager.php b/src/Schema/SQLServerSchemaManager.php
index 00a225b71a6..58185262aac 100644
--- a/src/Schema/SQLServerSchemaManager.php
+++ b/src/Schema/SQLServerSchemaManager.php
@@ -7,7 +7,6 @@
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Types\Type;
-use Doctrine\Deprecations\Deprecation;
use PDOException;
use function assert;
@@ -226,23 +225,6 @@ protected function _getPortableDatabaseDefinition(array $database): string
return $database['name'];
}
- /**
- * {@inheritdoc}
- *
- * @deprecated Use {@link listSchemaNames()} instead.
- */
- protected function getPortableNamespaceDefinition(array $namespace): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/issues/4503',
- 'SQLServerSchemaManager::getPortableNamespaceDefinition() is deprecated,'
- . ' use SQLServerSchemaManager::listSchemaNames() instead.'
- );
-
- return $namespace['name'];
- }
-
/**
* {@inheritdoc}
*/
diff --git a/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php b/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php
index dfa051ef4a0..b3a8cae5a5b 100644
--- a/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php
+++ b/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php
@@ -9,7 +9,6 @@
use Doctrine\DBAL\Schema;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
-use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\Types\BlobType;
@@ -20,7 +19,6 @@
use function array_map;
use function array_pop;
use function array_unshift;
-use function assert;
use function count;
use function preg_match;
use function strtolower;
@@ -47,9 +45,7 @@ public function testGetSearchPath(): void
public function testGetSchemaNames(): void
{
- assert($this->schemaManager instanceof PostgreSQLSchemaManager);
-
- $names = $this->schemaManager->getSchemaNames();
+ $names = $this->schemaManager->listSchemaNames();
self::assertContains('public', $names, 'The public schema should be found.');
}
diff --git a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
index 15356814644..f332de445a8 100644
--- a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
+++ b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
@@ -154,10 +154,7 @@ public function testListDatabases(): void
self::assertContains('test_create_database', $databases);
}
- /**
- * @dataProvider listSchemaNamesMethodProvider
- */
- public function testListSchemaNames(callable $method): void
+ public function testListSchemaNames(): void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsSchemas()) {
self::markTestSkipped('Platform does not support schemas.');
@@ -169,25 +166,7 @@ public function testListSchemaNames(callable $method): void
$this->schemaManager->getDatabasePlatform()->getCreateSchemaSQL('test_create_schema')
);
- self::assertContains('test_create_schema', $method($this->schemaManager));
- }
-
- /**
- * @return iterable>
- */
- public static function listSchemaNamesMethodProvider(): iterable
- {
- yield [
- static function (AbstractSchemaManager $schemaManager): array {
- return $schemaManager->listNamespaceNames();
- },
- ];
-
- yield [
- static function (AbstractSchemaManager $schemaManager): array {
- return $schemaManager->listSchemaNames();
- },
- ];
+ self::assertContains('test_create_schema', $this->schemaManager->listSchemaNames());
}
public function testListTables(): void