Add missing driver exception annotations

parent babdc32e
# Upgrade to 3.0 # Upgrade to 3.0
## BC BREAK: More driver-level methods are allowed to throw a Driver\Exception.
The following driver-level methods are allowed to throw a Driver\Exception:
- `Connection::prepare()`
- `Connection::lastInsertId()`
- `Connection::beginTransaction()`
- `Connection::commit()`
- `Connection::rollBack()`
- `ServerInfoAwareConnection::getServerVersion()`
- `Statement::bindParam()`
- `Statement::bindValue()`
- `Result::rowCount()`
- `Result::columnCount()`
## The `ExceptionConverterDriver` interface is removed ## The `ExceptionConverterDriver` interface is removed
All drivers must implement the `convertException()` method which is now part of the `Driver` interface. All drivers must implement the `convertException()` method which is now part of the `Driver` interface.
......
...@@ -15,6 +15,8 @@ interface Connection ...@@ -15,6 +15,8 @@ interface Connection
{ {
/** /**
* Prepares a statement for execution and returns a Statement object. * Prepares a statement for execution and returns a Statement object.
*
* @throws Exception
*/ */
public function prepare(string $sql): Statement; public function prepare(string $sql): Statement;
...@@ -48,6 +50,8 @@ interface Connection ...@@ -48,6 +50,8 @@ interface Connection
* @param string|null $name * @param string|null $name
* *
* @return string * @return string
*
* @throws Exception
*/ */
public function lastInsertId($name = null); public function lastInsertId($name = null);
...@@ -55,6 +59,8 @@ interface Connection ...@@ -55,6 +59,8 @@ interface Connection
* Initiates a transaction. * Initiates a transaction.
* *
* @return bool TRUE on success or FALSE on failure. * @return bool TRUE on success or FALSE on failure.
*
* @throws Exception
*/ */
public function beginTransaction(); public function beginTransaction();
...@@ -62,6 +68,8 @@ interface Connection ...@@ -62,6 +68,8 @@ interface Connection
* Commits a transaction. * Commits a transaction.
* *
* @return bool TRUE on success or FALSE on failure. * @return bool TRUE on success or FALSE on failure.
*
* @throws Exception
*/ */
public function commit(); public function commit();
...@@ -69,6 +77,8 @@ interface Connection ...@@ -69,6 +77,8 @@ interface Connection
* Rolls back the current transaction, as initiated by beginTransaction(). * Rolls back the current transaction, as initiated by beginTransaction().
* *
* @return bool TRUE on success or FALSE on failure. * @return bool TRUE on success or FALSE on failure.
*
* @throws Exception
*/ */
public function rollBack(); public function rollBack();
} }
...@@ -142,6 +142,8 @@ final class Statement implements StatementInterface ...@@ -142,6 +142,8 @@ final class Statement implements StatementInterface
/** /**
* Binds parameters with known types previously bound to the statement * Binds parameters with known types previously bound to the statement
*
* @throws Exception
*/ */
private function bindTypedParameters(): void private function bindTypedParameters(): void
{ {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Doctrine\DBAL\Driver\OCI8; namespace Doctrine\DBAL\Driver\OCI8;
use Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\Driver\OCI8\Exception\Error; use Doctrine\DBAL\Driver\OCI8\Exception\Error;
use Doctrine\DBAL\Driver\OCI8\Exception\UnknownParameterIndex; use Doctrine\DBAL\Driver\OCI8\Exception\UnknownParameterIndex;
use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\Result as ResultInterface;
...@@ -54,6 +55,8 @@ final class Statement implements StatementInterface ...@@ -54,6 +55,8 @@ final class Statement implements StatementInterface
* *
* @param resource $dbh The connection handle. * @param resource $dbh The connection handle.
* @param string $query The SQL query. * @param string $query The SQL query.
*
* @throws Exception
*/ */
public function __construct($dbh, $query, ExecutionMode $executionMode) public function __construct($dbh, $query, ExecutionMode $executionMode)
{ {
......
...@@ -50,6 +50,8 @@ class Statement implements StatementInterface ...@@ -50,6 +50,8 @@ class Statement implements StatementInterface
} }
/** /**
* {@inheritDoc}
*
* @param mixed $column * @param mixed $column
* @param mixed $variable * @param mixed $variable
* @param int $type * @param int $type
......
...@@ -4,6 +4,7 @@ namespace Doctrine\DBAL\Driver\PDOSqlsrv; ...@@ -4,6 +4,7 @@ namespace Doctrine\DBAL\Driver\PDOSqlsrv;
use Doctrine\DBAL\Driver\AbstractSQLServerDriver; use Doctrine\DBAL\Driver\AbstractSQLServerDriver;
use Doctrine\DBAL\Driver\AbstractSQLServerDriver\Exception\PortWithoutHost; use Doctrine\DBAL\Driver\AbstractSQLServerDriver\Exception\PortWithoutHost;
use Doctrine\DBAL\Driver\Exception;
use PDO; use PDO;
use function is_int; use function is_int;
...@@ -50,6 +51,8 @@ class Driver extends AbstractSQLServerDriver ...@@ -50,6 +51,8 @@ class Driver extends AbstractSQLServerDriver
* @param string[] $connectionOptions * @param string[] $connectionOptions
* *
* @return string The DSN. * @return string The DSN.
*
* @throws Exception
*/ */
private function _constructPdoDsn(array $params, array $connectionOptions) private function _constructPdoDsn(array $params, array $connectionOptions)
{ {
......
...@@ -71,6 +71,8 @@ interface Result ...@@ -71,6 +71,8 @@ interface Result
* is not guaranteed for all drivers and should not be relied on in portable applications. * is not guaranteed for all drivers and should not be relied on in portable applications.
* *
* @return int The number of rows. * @return int The number of rows.
*
* @throws Exception
*/ */
public function rowCount(): int; public function rowCount(): int;
...@@ -79,6 +81,8 @@ interface Result ...@@ -79,6 +81,8 @@ interface Result
* *
* @return int The number of columns in the result. If the columns cannot be counted, * @return int The number of columns in the result. If the columns cannot be counted,
* this method must return 0. * this method must return 0.
*
* @throws Exception
*/ */
public function columnCount(): int; public function columnCount(): int;
......
...@@ -11,6 +11,8 @@ interface ServerInfoAwareConnection extends Connection ...@@ -11,6 +11,8 @@ interface ServerInfoAwareConnection extends Connection
* Returns the version number of the database server connected to. * Returns the version number of the database server connected to.
* *
* @return string * @return string
*
* @throws Exception
*/ */
public function getServerVersion(); public function getServerVersion();
} }
...@@ -24,6 +24,8 @@ interface Statement ...@@ -24,6 +24,8 @@ interface Statement
* constants. * constants.
* *
* @return bool TRUE on success or FALSE on failure. * @return bool TRUE on success or FALSE on failure.
*
* @throws Exception
*/ */
public function bindValue($param, $value, $type = ParameterType::STRING); public function bindValue($param, $value, $type = ParameterType::STRING);
...@@ -51,6 +53,8 @@ interface Statement ...@@ -51,6 +53,8 @@ interface Statement
* so that PHP allocates enough memory to hold the returned value. * so that PHP allocates enough memory to hold the returned value.
* *
* @return bool TRUE on success or FALSE on failure. * @return bool TRUE on success or FALSE on failure.
*
* @throws Exception
*/ */
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null); public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null);
......
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