Unverified Commit f440d92c authored by Luís Cobucci's avatar Luís Cobucci Committed by Sergei Morozov

Respect interface's return type in methods

parent ab88b960
...@@ -46,6 +46,8 @@ class ArrayStatement implements IteratorAggregate, ResultStatement ...@@ -46,6 +46,8 @@ class ArrayStatement implements IteratorAggregate, ResultStatement
public function closeCursor() public function closeCursor()
{ {
unset($this->data); unset($this->data);
return true;
} }
/** /**
......
...@@ -8,6 +8,7 @@ use Doctrine\DBAL\ParameterType; ...@@ -8,6 +8,7 @@ use Doctrine\DBAL\ParameterType;
use stdClass; use stdClass;
use const DB2_AUTOCOMMIT_OFF; use const DB2_AUTOCOMMIT_OFF;
use const DB2_AUTOCOMMIT_ON; use const DB2_AUTOCOMMIT_ON;
use function assert;
use function db2_autocommit; use function db2_autocommit;
use function db2_commit; use function db2_commit;
use function db2_conn_error; use function db2_conn_error;
...@@ -23,6 +24,7 @@ use function db2_rollback; ...@@ -23,6 +24,7 @@ use function db2_rollback;
use function db2_server_info; use function db2_server_info;
use function db2_stmt_errormsg; use function db2_stmt_errormsg;
use function func_get_args; use function func_get_args;
use function is_bool;
class DB2Connection implements Connection, ServerInfoAwareConnection class DB2Connection implements Connection, ServerInfoAwareConnection
{ {
...@@ -140,7 +142,10 @@ class DB2Connection implements Connection, ServerInfoAwareConnection ...@@ -140,7 +142,10 @@ class DB2Connection implements Connection, ServerInfoAwareConnection
*/ */
public function beginTransaction() public function beginTransaction()
{ {
db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF); $result = db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF);
assert(is_bool($result));
return $result;
} }
/** /**
...@@ -151,7 +156,11 @@ class DB2Connection implements Connection, ServerInfoAwareConnection ...@@ -151,7 +156,11 @@ class DB2Connection implements Connection, ServerInfoAwareConnection
if (! db2_commit($this->conn)) { if (! db2_commit($this->conn)) {
throw new DB2Exception(db2_conn_errormsg($this->conn)); throw new DB2Exception(db2_conn_errormsg($this->conn));
} }
db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON);
$result = db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON);
assert(is_bool($result));
return $result;
} }
/** /**
...@@ -162,7 +171,11 @@ class DB2Connection implements Connection, ServerInfoAwareConnection ...@@ -162,7 +171,11 @@ class DB2Connection implements Connection, ServerInfoAwareConnection
if (! db2_rollback($this->conn)) { if (! db2_rollback($this->conn)) {
throw new DB2Exception(db2_conn_errormsg($this->conn)); throw new DB2Exception(db2_conn_errormsg($this->conn));
} }
db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON);
$result = db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON);
assert(is_bool($result));
return $result;
} }
/** /**
......
...@@ -313,6 +313,8 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -313,6 +313,8 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
$this->defaultFetchMode = $fetchMode; $this->defaultFetchMode = $fetchMode;
$this->defaultFetchClass = $arg2 ?: $this->defaultFetchClass; $this->defaultFetchClass = $arg2 ?: $this->defaultFetchClass;
$this->defaultFetchClassCtorArgs = $arg3 ? (array) $arg3 : $this->defaultFetchClassCtorArgs; $this->defaultFetchClassCtorArgs = $arg3 ? (array) $arg3 : $this->defaultFetchClassCtorArgs;
return true;
} }
/** /**
......
...@@ -152,6 +152,8 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection ...@@ -152,6 +152,8 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
if (! sqlsrv_begin_transaction($this->conn)) { if (! sqlsrv_begin_transaction($this->conn)) {
throw SQLSrvException::fromSqlSrvErrors(); throw SQLSrvException::fromSqlSrvErrors();
} }
return true;
} }
/** /**
...@@ -162,6 +164,8 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection ...@@ -162,6 +164,8 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
if (! sqlsrv_commit($this->conn)) { if (! sqlsrv_commit($this->conn)) {
throw SQLSrvException::fromSqlSrvErrors(); throw SQLSrvException::fromSqlSrvErrors();
} }
return true;
} }
/** /**
...@@ -172,6 +176,8 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection ...@@ -172,6 +176,8 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
if (! sqlsrv_rollback($this->conn)) { if (! sqlsrv_rollback($this->conn)) {
throw SQLSrvException::fromSqlSrvErrors(); throw SQLSrvException::fromSqlSrvErrors();
} }
return true;
} }
/** /**
......
...@@ -158,6 +158,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -158,6 +158,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement
$this->variables[$param] = $value; $this->variables[$param] = $value;
$this->types[$param] = $type; $this->types[$param] = $type;
return true;
} }
/** /**
...@@ -174,6 +176,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -174,6 +176,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement
// unset the statement resource if it exists as the new one will need to be bound to the new variable // unset the statement resource if it exists as the new one will need to be bound to the new variable
$this->stmt = null; $this->stmt = null;
return true;
} }
/** /**
...@@ -263,6 +267,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -263,6 +267,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement
} }
$this->result = true; $this->result = true;
return true;
} }
/** /**
......
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