Add missing exception annotation to schema managers

parent 93e61511
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace Doctrine\DBAL\Schema; namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ConnectionException;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs; use Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs;
use Doctrine\DBAL\Event\SchemaIndexDefinitionEventArgs; use Doctrine\DBAL\Event\SchemaIndexDefinitionEventArgs;
...@@ -93,6 +92,8 @@ abstract class AbstractSchemaManager ...@@ -93,6 +92,8 @@ abstract class AbstractSchemaManager
* Lists the available databases for this connection. * Lists the available databases for this connection.
* *
* @return string[] * @return string[]
*
* @throws DBALException
*/ */
public function listDatabases() public function listDatabases()
{ {
...@@ -107,6 +108,8 @@ abstract class AbstractSchemaManager ...@@ -107,6 +108,8 @@ abstract class AbstractSchemaManager
* Returns a list of all namespaces in the current database. * Returns a list of all namespaces in the current database.
* *
* @return string[] * @return string[]
*
* @throws DBALException
*/ */
public function listNamespaceNames() public function listNamespaceNames()
{ {
...@@ -123,6 +126,8 @@ abstract class AbstractSchemaManager ...@@ -123,6 +126,8 @@ abstract class AbstractSchemaManager
* @param string|null $database * @param string|null $database
* *
* @return Sequence[] * @return Sequence[]
*
* @throws DBALException
*/ */
public function listSequences($database = null) public function listSequences($database = null)
{ {
...@@ -151,6 +156,8 @@ abstract class AbstractSchemaManager ...@@ -151,6 +156,8 @@ abstract class AbstractSchemaManager
* @param string|null $database * @param string|null $database
* *
* @return Column[] * @return Column[]
*
* @throws DBALException
*/ */
public function listTableColumns($table, $database = null) public function listTableColumns($table, $database = null)
{ {
...@@ -173,6 +180,8 @@ abstract class AbstractSchemaManager ...@@ -173,6 +180,8 @@ abstract class AbstractSchemaManager
* @param string $table The name of the table. * @param string $table The name of the table.
* *
* @return Index[] * @return Index[]
*
* @throws DBALException
*/ */
public function listTableIndexes($table) public function listTableIndexes($table)
{ {
...@@ -191,6 +200,8 @@ abstract class AbstractSchemaManager ...@@ -191,6 +200,8 @@ abstract class AbstractSchemaManager
* @param string|string[] $tableNames * @param string|string[] $tableNames
* *
* @return bool * @return bool
*
* @throws DBALException
*/ */
public function tablesExist($tableNames) public function tablesExist($tableNames)
{ {
...@@ -203,6 +214,8 @@ abstract class AbstractSchemaManager ...@@ -203,6 +214,8 @@ abstract class AbstractSchemaManager
* Returns a list of all tables in the current database. * Returns a list of all tables in the current database.
* *
* @return string[] * @return string[]
*
* @throws DBALException
*/ */
public function listTableNames() public function listTableNames()
{ {
...@@ -236,6 +249,8 @@ abstract class AbstractSchemaManager ...@@ -236,6 +249,8 @@ abstract class AbstractSchemaManager
* Lists the tables for this connection. * Lists the tables for this connection.
* *
* @return Table[] * @return Table[]
*
* @throws DBALException
*/ */
public function listTables() public function listTables()
{ {
...@@ -253,6 +268,8 @@ abstract class AbstractSchemaManager ...@@ -253,6 +268,8 @@ abstract class AbstractSchemaManager
* @param string $tableName * @param string $tableName
* *
* @return Table * @return Table
*
* @throws DBALException
*/ */
public function listTableDetails($tableName) public function listTableDetails($tableName)
{ {
...@@ -271,6 +288,8 @@ abstract class AbstractSchemaManager ...@@ -271,6 +288,8 @@ abstract class AbstractSchemaManager
* Lists the views this connection has. * Lists the views this connection has.
* *
* @return View[] * @return View[]
*
* @throws DBALException
*/ */
public function listViews() public function listViews()
{ {
...@@ -288,6 +307,8 @@ abstract class AbstractSchemaManager ...@@ -288,6 +307,8 @@ abstract class AbstractSchemaManager
* @param string|null $database * @param string|null $database
* *
* @return ForeignKeyConstraint[] * @return ForeignKeyConstraint[]
*
* @throws DBALException
*/ */
public function listTableForeignKeys($table, $database = null) public function listTableForeignKeys($table, $database = null)
{ {
...@@ -311,6 +332,8 @@ abstract class AbstractSchemaManager ...@@ -311,6 +332,8 @@ abstract class AbstractSchemaManager
* @param string $database The name of the database to drop. * @param string $database The name of the database to drop.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropDatabase($database) public function dropDatabase($database)
{ {
...@@ -323,6 +346,8 @@ abstract class AbstractSchemaManager ...@@ -323,6 +346,8 @@ abstract class AbstractSchemaManager
* @param string $tableName The name of the table to drop. * @param string $tableName The name of the table to drop.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropTable($tableName) public function dropTable($tableName)
{ {
...@@ -336,6 +361,8 @@ abstract class AbstractSchemaManager ...@@ -336,6 +361,8 @@ abstract class AbstractSchemaManager
* @param Table|string $table The name of the table. * @param Table|string $table The name of the table.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropIndex($index, $table) public function dropIndex($index, $table)
{ {
...@@ -352,6 +379,8 @@ abstract class AbstractSchemaManager ...@@ -352,6 +379,8 @@ abstract class AbstractSchemaManager
* @param Table|string $table The name of the table. * @param Table|string $table The name of the table.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropConstraint(Constraint $constraint, $table) public function dropConstraint(Constraint $constraint, $table)
{ {
...@@ -365,6 +394,8 @@ abstract class AbstractSchemaManager ...@@ -365,6 +394,8 @@ abstract class AbstractSchemaManager
* @param Table|string $table The name of the table with the foreign key. * @param Table|string $table The name of the table with the foreign key.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropForeignKey($foreignKey, $table) public function dropForeignKey($foreignKey, $table)
{ {
...@@ -377,6 +408,8 @@ abstract class AbstractSchemaManager ...@@ -377,6 +408,8 @@ abstract class AbstractSchemaManager
* @param string $name The name of the sequence to drop. * @param string $name The name of the sequence to drop.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropSequence($name) public function dropSequence($name)
{ {
...@@ -389,6 +422,8 @@ abstract class AbstractSchemaManager ...@@ -389,6 +422,8 @@ abstract class AbstractSchemaManager
* @param string $name The name of the view. * @param string $name The name of the view.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropView($name) public function dropView($name)
{ {
...@@ -403,6 +438,8 @@ abstract class AbstractSchemaManager ...@@ -403,6 +438,8 @@ abstract class AbstractSchemaManager
* @param string $database The name of the database to create. * @param string $database The name of the database to create.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function createDatabase($database) public function createDatabase($database)
{ {
...@@ -413,6 +450,8 @@ abstract class AbstractSchemaManager ...@@ -413,6 +450,8 @@ abstract class AbstractSchemaManager
* Creates a new table. * Creates a new table.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function createTable(Table $table) public function createTable(Table $table)
{ {
...@@ -427,7 +466,7 @@ abstract class AbstractSchemaManager ...@@ -427,7 +466,7 @@ abstract class AbstractSchemaManager
* *
* @return void * @return void
* *
* @throws ConnectionException If something fails at database level. * @throws DBALException
*/ */
public function createSequence($sequence) public function createSequence($sequence)
{ {
...@@ -440,6 +479,8 @@ abstract class AbstractSchemaManager ...@@ -440,6 +479,8 @@ abstract class AbstractSchemaManager
* @param Table|string $table * @param Table|string $table
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function createConstraint(Constraint $constraint, $table) public function createConstraint(Constraint $constraint, $table)
{ {
...@@ -452,6 +493,8 @@ abstract class AbstractSchemaManager ...@@ -452,6 +493,8 @@ abstract class AbstractSchemaManager
* @param Table|string $table The name of the table on which the index is to be created. * @param Table|string $table The name of the table on which the index is to be created.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function createIndex(Index $index, $table) public function createIndex(Index $index, $table)
{ {
...@@ -465,6 +508,8 @@ abstract class AbstractSchemaManager ...@@ -465,6 +508,8 @@ abstract class AbstractSchemaManager
* @param Table|string $table The name of the table on which the foreign key is to be created. * @param Table|string $table The name of the table on which the foreign key is to be created.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function createForeignKey(ForeignKeyConstraint $foreignKey, $table) public function createForeignKey(ForeignKeyConstraint $foreignKey, $table)
{ {
...@@ -475,6 +520,8 @@ abstract class AbstractSchemaManager ...@@ -475,6 +520,8 @@ abstract class AbstractSchemaManager
* Creates a new view. * Creates a new view.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function createView(View $view) public function createView(View $view)
{ {
...@@ -492,6 +539,8 @@ abstract class AbstractSchemaManager ...@@ -492,6 +539,8 @@ abstract class AbstractSchemaManager
* @param Table|string $table * @param Table|string $table
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropAndCreateConstraint(Constraint $constraint, $table) public function dropAndCreateConstraint(Constraint $constraint, $table)
{ {
...@@ -505,6 +554,8 @@ abstract class AbstractSchemaManager ...@@ -505,6 +554,8 @@ abstract class AbstractSchemaManager
* @param Table|string $table The name of the table on which the index is to be created. * @param Table|string $table The name of the table on which the index is to be created.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropAndCreateIndex(Index $index, $table) public function dropAndCreateIndex(Index $index, $table)
{ {
...@@ -519,6 +570,8 @@ abstract class AbstractSchemaManager ...@@ -519,6 +570,8 @@ abstract class AbstractSchemaManager
* @param Table|string $table The name of the table on which the foreign key is to be created. * @param Table|string $table The name of the table on which the foreign key is to be created.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table) public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table)
{ {
...@@ -531,7 +584,7 @@ abstract class AbstractSchemaManager ...@@ -531,7 +584,7 @@ abstract class AbstractSchemaManager
* *
* @return void * @return void
* *
* @throws ConnectionException If something fails at database level. * @throws DBALException
*/ */
public function dropAndCreateSequence(Sequence $sequence) public function dropAndCreateSequence(Sequence $sequence)
{ {
...@@ -543,6 +596,8 @@ abstract class AbstractSchemaManager ...@@ -543,6 +596,8 @@ abstract class AbstractSchemaManager
* Drops and creates a new table. * Drops and creates a new table.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropAndCreateTable(Table $table) public function dropAndCreateTable(Table $table)
{ {
...@@ -556,6 +611,8 @@ abstract class AbstractSchemaManager ...@@ -556,6 +611,8 @@ abstract class AbstractSchemaManager
* @param string $database The name of the database to create. * @param string $database The name of the database to create.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropAndCreateDatabase($database) public function dropAndCreateDatabase($database)
{ {
...@@ -567,6 +624,8 @@ abstract class AbstractSchemaManager ...@@ -567,6 +624,8 @@ abstract class AbstractSchemaManager
* Drops and creates a new view. * Drops and creates a new view.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function dropAndCreateView(View $view) public function dropAndCreateView(View $view)
{ {
...@@ -580,6 +639,8 @@ abstract class AbstractSchemaManager ...@@ -580,6 +639,8 @@ abstract class AbstractSchemaManager
* Alters an existing tables schema. * Alters an existing tables schema.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function alterTable(TableDiff $tableDiff) public function alterTable(TableDiff $tableDiff)
{ {
...@@ -597,6 +658,8 @@ abstract class AbstractSchemaManager ...@@ -597,6 +658,8 @@ abstract class AbstractSchemaManager
* @param string $newName The new name of the table. * @param string $newName The new name of the table.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
public function renameTable($name, $newName) public function renameTable($name, $newName)
{ {
...@@ -700,6 +763,8 @@ abstract class AbstractSchemaManager ...@@ -700,6 +763,8 @@ abstract class AbstractSchemaManager
* @param mixed[][] $sequences * @param mixed[][] $sequences
* *
* @return Sequence[] * @return Sequence[]
*
* @throws DBALException
*/ */
protected function _getPortableSequencesList($sequences) protected function _getPortableSequencesList($sequences)
{ {
...@@ -734,6 +799,8 @@ abstract class AbstractSchemaManager ...@@ -734,6 +799,8 @@ abstract class AbstractSchemaManager
* @param mixed[][] $tableColumns * @param mixed[][] $tableColumns
* *
* @return Column[] * @return Column[]
*
* @throws DBALException
*/ */
protected function _getPortableTableColumnList($table, $database, $tableColumns) protected function _getPortableTableColumnList($table, $database, $tableColumns)
{ {
...@@ -773,6 +840,8 @@ abstract class AbstractSchemaManager ...@@ -773,6 +840,8 @@ abstract class AbstractSchemaManager
* @param mixed[] $tableColumn * @param mixed[] $tableColumn
* *
* @return Column * @return Column
*
* @throws DBALException
*/ */
abstract protected function _getPortableTableColumnDefinition($tableColumn); abstract protected function _getPortableTableColumnDefinition($tableColumn);
...@@ -783,6 +852,8 @@ abstract class AbstractSchemaManager ...@@ -783,6 +852,8 @@ abstract class AbstractSchemaManager
* @param string|null $tableName * @param string|null $tableName
* *
* @return Index[] * @return Index[]
*
* @throws DBALException
*/ */
protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null) protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null)
{ {
...@@ -959,6 +1030,8 @@ abstract class AbstractSchemaManager ...@@ -959,6 +1030,8 @@ abstract class AbstractSchemaManager
* @param string[]|string $sql * @param string[]|string $sql
* *
* @return void * @return void
*
* @throws DBALException
*/ */
protected function _execSql($sql) protected function _execSql($sql)
{ {
...@@ -971,6 +1044,8 @@ abstract class AbstractSchemaManager ...@@ -971,6 +1044,8 @@ abstract class AbstractSchemaManager
* Creates a schema instance for the current database. * Creates a schema instance for the current database.
* *
* @return Schema * @return Schema
*
* @throws DBALException
*/ */
public function createSchema() public function createSchema()
{ {
...@@ -995,6 +1070,8 @@ abstract class AbstractSchemaManager ...@@ -995,6 +1070,8 @@ abstract class AbstractSchemaManager
* Creates the configuration for this schema. * Creates the configuration for this schema.
* *
* @return SchemaConfig * @return SchemaConfig
*
* @throws DBALException
*/ */
public function createSchemaConfig() public function createSchemaConfig()
{ {
...@@ -1031,6 +1108,8 @@ abstract class AbstractSchemaManager ...@@ -1031,6 +1108,8 @@ abstract class AbstractSchemaManager
* returns the name of the currently connected database. * returns the name of the currently connected database.
* *
* @return string[] * @return string[]
*
* @throws DBALException
*/ */
public function getSchemaSearchPaths() public function getSchemaSearchPaths()
{ {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Doctrine\DBAL\Schema; namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Platforms\DB2Platform; use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
...@@ -37,6 +38,8 @@ class DB2SchemaManager extends AbstractSchemaManager ...@@ -37,6 +38,8 @@ class DB2SchemaManager extends AbstractSchemaManager
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @throws DBALException
*/ */
protected function _getPortableTableColumnDefinition($tableColumn) protected function _getPortableTableColumnDefinition($tableColumn)
{ {
......
...@@ -297,6 +297,8 @@ class OracleSchemaManager extends AbstractSchemaManager ...@@ -297,6 +297,8 @@ class OracleSchemaManager extends AbstractSchemaManager
* @param string $table * @param string $table
* *
* @return bool * @return bool
*
* @throws DBALException
*/ */
public function dropAutoincrement($table) public function dropAutoincrement($table)
{ {
...@@ -347,6 +349,8 @@ class OracleSchemaManager extends AbstractSchemaManager ...@@ -347,6 +349,8 @@ class OracleSchemaManager extends AbstractSchemaManager
* @param string $user The name of the user to kill sessions for. * @param string $user The name of the user to kill sessions for.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
private function killUserSessions($user) private function killUserSessions($user)
{ {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Doctrine\DBAL\Schema; namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Exception\DriverException;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
...@@ -39,6 +40,8 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -39,6 +40,8 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
* Gets all the existing schema names. * Gets all the existing schema names.
* *
* @return string[] * @return string[]
*
* @throws DBALException
*/ */
public function getSchemaNames() public function getSchemaNames()
{ {
...@@ -46,11 +49,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -46,11 +49,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
} }
/** /**
* Returns an array of schema search paths. * {@inheritDoc}
*
* This is a PostgreSQL only function.
*
* @return string[]
*/ */
public function getSchemaSearchPaths() public function getSchemaSearchPaths()
{ {
......
...@@ -319,6 +319,8 @@ class SQLServerSchemaManager extends AbstractSchemaManager ...@@ -319,6 +319,8 @@ class SQLServerSchemaManager extends AbstractSchemaManager
* @param string $database The name of the database to close currently active connections for. * @param string $database The name of the database to close currently active connections for.
* *
* @return void * @return void
*
* @throws DBALException
*/ */
private function closeActiveDatabaseConnections($database) private function closeActiveDatabaseConnections($database)
{ {
...@@ -334,6 +336,8 @@ class SQLServerSchemaManager extends AbstractSchemaManager ...@@ -334,6 +336,8 @@ class SQLServerSchemaManager extends AbstractSchemaManager
/** /**
* @param string $tableName * @param string $tableName
*
* @throws DBALException
*/ */
public function listTableDetails($tableName): Table public function listTableDetails($tableName): Table
{ {
......
...@@ -501,6 +501,9 @@ CREATE\sTABLE # Match "CREATE TABLE" ...@@ -501,6 +501,9 @@ CREATE\sTABLE # Match "CREATE TABLE"
return $comment === '' ? null : $comment; return $comment === '' ? null : $comment;
} }
/**
* @throws DBALException
*/
private function getCreateTableSQL(string $table): string private function getCreateTableSQL(string $table): string
{ {
$sql = $this->_conn->fetchOne( $sql = $this->_conn->fetchOne(
...@@ -528,6 +531,8 @@ SQL ...@@ -528,6 +531,8 @@ SQL
} }
/** /**
* {@inheritDoc}
*
* @param string $tableName * @param string $tableName
*/ */
public function listTableDetails($tableName): Table public function listTableDetails($tableName): Table
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Schema\Synchronizer; namespace Doctrine\DBAL\Schema\Synchronizer;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Throwable; use Throwable;
/** /**
...@@ -37,6 +38,8 @@ abstract class AbstractSchemaSynchronizer implements SchemaSynchronizer ...@@ -37,6 +38,8 @@ abstract class AbstractSchemaSynchronizer implements SchemaSynchronizer
* @param string[] $sql * @param string[] $sql
* *
* @return void * @return void
*
* @throws DBALException
*/ */
protected function processSql(array $sql) protected function processSql(array $sql)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment