Commit cd3bebc0 authored by Alessandro Minoccheri's avatar Alessandro Minoccheri

fixed all array declarations inside Driver dir

parent 7bac6913
...@@ -32,7 +32,7 @@ class Driver extends \Doctrine\DBAL\Driver\PDOMySql\Driver ...@@ -32,7 +32,7 @@ class Driver extends \Doctrine\DBAL\Driver\PDOMySql\Driver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
$conn = new Connection( $conn = new Connection(
$this->constructPdoDsn($params), $this->constructPdoDsn($params),
......
...@@ -37,7 +37,7 @@ class DB2Connection implements Connection, ServerInfoAwareConnection ...@@ -37,7 +37,7 @@ class DB2Connection implements Connection, ServerInfoAwareConnection
* *
* @throws \Doctrine\DBAL\Driver\IBMDB2\DB2Exception * @throws \Doctrine\DBAL\Driver\IBMDB2\DB2Exception
*/ */
public function __construct(array $params, $username, $password, $driverOptions = array()) public function __construct(array $params, $username, $password, $driverOptions = [])
{ {
$isPersistent = (isset($params['persistent']) && $params['persistent'] == true); $isPersistent = (isset($params['persistent']) && $params['persistent'] == true);
...@@ -173,9 +173,9 @@ class DB2Connection implements Connection, ServerInfoAwareConnection ...@@ -173,9 +173,9 @@ class DB2Connection implements Connection, ServerInfoAwareConnection
*/ */
public function errorInfo() public function errorInfo()
{ {
return array( return [
0 => db2_conn_errormsg($this->_conn), 0 => db2_conn_errormsg($this->_conn),
1 => $this->errorCode(), 1 => $this->errorCode(),
); ];
} }
} }
...@@ -32,7 +32,7 @@ class DB2Driver extends AbstractDB2Driver ...@@ -32,7 +32,7 @@ class DB2Driver extends AbstractDB2Driver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
if ( ! isset($params['protocol'])) { if ( ! isset($params['protocol'])) {
$params['protocol'] = 'TCPIP'; $params['protocol'] = 'TCPIP';
......
...@@ -31,7 +31,7 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -31,7 +31,7 @@ class DB2Statement implements \IteratorAggregate, Statement
/** /**
* @var array * @var array
*/ */
private $_bindParam = array(); private $_bindParam = [];
/** /**
* @var string Name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS. * @var string Name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
...@@ -41,7 +41,7 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -41,7 +41,7 @@ class DB2Statement implements \IteratorAggregate, Statement
/** /**
* @var string Constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS. * @var string Constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
*/ */
private $defaultFetchClassCtorArgs = array(); private $defaultFetchClassCtorArgs = [];
/** /**
* @var integer * @var integer
...@@ -60,10 +60,10 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -60,10 +60,10 @@ class DB2Statement implements \IteratorAggregate, Statement
* *
* @var array * @var array
*/ */
static private $_typeMap = array( static private $_typeMap = [
\PDO::PARAM_INT => DB2_LONG, \PDO::PARAM_INT => DB2_LONG,
\PDO::PARAM_STR => DB2_CHAR, \PDO::PARAM_STR => DB2_CHAR,
); ];
/** /**
* @param resource $stmt * @param resource $stmt
...@@ -110,7 +110,7 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -110,7 +110,7 @@ class DB2Statement implements \IteratorAggregate, Statement
return false; return false;
} }
$this->_bindParam = array(); $this->_bindParam = [];
if (!db2_free_result($this->_stmt)) { if (!db2_free_result($this->_stmt)) {
return false; return false;
...@@ -146,10 +146,10 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -146,10 +146,10 @@ class DB2Statement implements \IteratorAggregate, Statement
*/ */
public function errorInfo() public function errorInfo()
{ {
return array( return [
db2_stmt_errormsg(), db2_stmt_errormsg(),
db2_stmt_error(), db2_stmt_error(),
); ];
} }
/** /**
...@@ -164,7 +164,7 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -164,7 +164,7 @@ class DB2Statement implements \IteratorAggregate, Statement
if ($params === null) { if ($params === null) {
ksort($this->_bindParam); ksort($this->_bindParam);
$params = array(); $params = [];
foreach ($this->_bindParam as $column => $value) { foreach ($this->_bindParam as $column => $value) {
$params[] = $value; $params[] = $value;
...@@ -228,7 +228,7 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -228,7 +228,7 @@ class DB2Statement implements \IteratorAggregate, Statement
if (func_num_args() >= 2) { if (func_num_args() >= 2) {
$args = func_get_args(); $args = func_get_args();
$className = $args[1]; $className = $args[1];
$ctorArgs = isset($args[2]) ? $args[2] : array(); $ctorArgs = isset($args[2]) ? $args[2] : [];
} }
$result = db2_fetch_object($this->_stmt); $result = db2_fetch_object($this->_stmt);
...@@ -252,11 +252,11 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -252,11 +252,11 @@ class DB2Statement implements \IteratorAggregate, Statement
*/ */
public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
{ {
$rows = array(); $rows = [];
switch ($fetchMode) { switch ($fetchMode) {
case \PDO::FETCH_CLASS: case \PDO::FETCH_CLASS:
while ($row = call_user_func_array(array($this, 'fetch'), func_get_args())) { while ($row = call_user_func_array([$this, 'fetch'], func_get_args())) {
$rows[] = $row; $rows[] = $row;
} }
break; break;
...@@ -293,7 +293,7 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -293,7 +293,7 @@ class DB2Statement implements \IteratorAggregate, Statement
*/ */
public function rowCount() public function rowCount()
{ {
return (@db2_num_rows($this->_stmt))?:0; return (@db2_num_rows($this->_stmt)) ? : 0;
} }
/** /**
...@@ -307,7 +307,7 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -307,7 +307,7 @@ class DB2Statement implements \IteratorAggregate, Statement
* *
* @throws DB2Exception * @throws DB2Exception
*/ */
private function castObject(\stdClass $sourceObject, $destinationClass, array $ctorArgs = array()) private function castObject(\stdClass $sourceObject, $destinationClass, array $ctorArgs = [])
{ {
if ( ! is_string($destinationClass)) { if ( ! is_string($destinationClass)) {
if ( ! is_object($destinationClass)) { if ( ! is_object($destinationClass)) {
......
...@@ -30,7 +30,7 @@ class Driver extends AbstractMySQLDriver ...@@ -30,7 +30,7 @@ class Driver extends AbstractMySQLDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
try { try {
return new MysqliConnection($params, $username, $password, $driverOptions); return new MysqliConnection($params, $username, $password, $driverOptions);
......
...@@ -47,7 +47,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar ...@@ -47,7 +47,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
* *
* @throws \Doctrine\DBAL\Driver\Mysqli\MysqliException * @throws \Doctrine\DBAL\Driver\Mysqli\MysqliException
*/ */
public function __construct(array $params, $username, $password, array $driverOptions = array()) public function __construct(array $params, $username, $password, array $driverOptions = [])
{ {
$port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port'); $port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port');
...@@ -211,15 +211,15 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar ...@@ -211,15 +211,15 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
* @throws MysqliException When one of of the options is not supported. * @throws MysqliException When one of of the options is not supported.
* @throws MysqliException When applying doesn't work - e.g. due to incorrect value. * @throws MysqliException When applying doesn't work - e.g. due to incorrect value.
*/ */
private function setDriverOptions(array $driverOptions = array()) private function setDriverOptions(array $driverOptions = [])
{ {
$supportedDriverOptions = array( $supportedDriverOptions = [
\MYSQLI_OPT_CONNECT_TIMEOUT, \MYSQLI_OPT_CONNECT_TIMEOUT,
\MYSQLI_OPT_LOCAL_INFILE, \MYSQLI_OPT_LOCAL_INFILE,
\MYSQLI_INIT_COMMAND, \MYSQLI_INIT_COMMAND,
\MYSQLI_READ_DEFAULT_FILE, \MYSQLI_READ_DEFAULT_FILE,
\MYSQLI_READ_DEFAULT_GROUP, \MYSQLI_READ_DEFAULT_GROUP,
); ];
if (defined('MYSQLI_SERVER_PUBLIC_KEY')) { if (defined('MYSQLI_SERVER_PUBLIC_KEY')) {
$supportedDriverOptions[] = \MYSQLI_SERVER_PUBLIC_KEY; $supportedDriverOptions[] = \MYSQLI_SERVER_PUBLIC_KEY;
......
...@@ -30,13 +30,13 @@ class MysqliStatement implements \IteratorAggregate, Statement ...@@ -30,13 +30,13 @@ class MysqliStatement implements \IteratorAggregate, Statement
/** /**
* @var array * @var array
*/ */
protected static $_paramTypeMap = array( protected static $_paramTypeMap = [
PDO::PARAM_STR => 's', PDO::PARAM_STR => 's',
PDO::PARAM_BOOL => 'i', PDO::PARAM_BOOL => 'i',
PDO::PARAM_NULL => 's', PDO::PARAM_NULL => 's',
PDO::PARAM_INT => 'i', PDO::PARAM_INT => 'i',
PDO::PARAM_LOB => 's' // TODO Support LOB bigger then max package size. PDO::PARAM_LOB => 's' // TODO Support LOB bigger then max package size.
); ];
/** /**
* @var \mysqli * @var \mysqli
...@@ -73,7 +73,7 @@ class MysqliStatement implements \IteratorAggregate, Statement ...@@ -73,7 +73,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
* *
* @var array * @var array
*/ */
protected $_values = array(); protected $_values = [];
/** /**
* @var integer * @var integer
...@@ -162,7 +162,7 @@ class MysqliStatement implements \IteratorAggregate, Statement ...@@ -162,7 +162,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
throw new MysqliException($this->_stmt->error, $this->_stmt->errno); throw new MysqliException($this->_stmt->error, $this->_stmt->errno);
} }
} else { } else {
if (!call_user_func_array(array($this->_stmt, 'bind_param'), array($this->types) + $this->_bindedValues)) { if (!call_user_func_array([$this->_stmt, 'bind_param'], [$this->types] + $this->_bindedValues)) {
throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno); throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno);
} }
} }
...@@ -175,7 +175,7 @@ class MysqliStatement implements \IteratorAggregate, Statement ...@@ -175,7 +175,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
if (null === $this->_columnNames) { if (null === $this->_columnNames) {
$meta = $this->_stmt->result_metadata(); $meta = $this->_stmt->result_metadata();
if (false !== $meta) { if (false !== $meta) {
$columnNames = array(); $columnNames = [];
foreach ($meta->fetch_fields() as $col) { foreach ($meta->fetch_fields() as $col) {
$columnNames[] = $col->name; $columnNames[] = $col->name;
} }
...@@ -206,12 +206,12 @@ class MysqliStatement implements \IteratorAggregate, Statement ...@@ -206,12 +206,12 @@ class MysqliStatement implements \IteratorAggregate, Statement
// to the length of the ones fetched during the previous execution. // to the length of the ones fetched during the previous execution.
$this->_rowBindedValues = array_fill(0, count($this->_columnNames), null); $this->_rowBindedValues = array_fill(0, count($this->_columnNames), null);
$refs = array(); $refs = [];
foreach ($this->_rowBindedValues as $key => &$value) { foreach ($this->_rowBindedValues as $key => &$value) {
$refs[$key] =& $value; $refs[$key] =& $value;
} }
if (!call_user_func_array(array($this->_stmt, 'bind_result'), $refs)) { if (!call_user_func_array([$this->_stmt, 'bind_result'], $refs)) {
throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno); throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno);
} }
} }
...@@ -230,7 +230,7 @@ class MysqliStatement implements \IteratorAggregate, Statement ...@@ -230,7 +230,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
*/ */
private function _bindValues($values) private function _bindValues($values)
{ {
$params = array(); $params = [];
$types = str_repeat('s', count($values)); $types = str_repeat('s', count($values));
$params[0] = $types; $params[0] = $types;
...@@ -238,7 +238,7 @@ class MysqliStatement implements \IteratorAggregate, Statement ...@@ -238,7 +238,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
$params[] =& $v; $params[] =& $v;
} }
return call_user_func_array(array($this->_stmt, 'bind_param'), $params); return call_user_func_array([$this->_stmt, 'bind_param'], $params);
} }
/** /**
...@@ -249,7 +249,7 @@ class MysqliStatement implements \IteratorAggregate, Statement ...@@ -249,7 +249,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
$ret = $this->_stmt->fetch(); $ret = $this->_stmt->fetch();
if (true === $ret) { if (true === $ret) {
$values = array(); $values = [];
foreach ($this->_rowBindedValues as $v) { foreach ($this->_rowBindedValues as $v) {
$values[] = $v; $values[] = $v;
} }
...@@ -317,7 +317,7 @@ class MysqliStatement implements \IteratorAggregate, Statement ...@@ -317,7 +317,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
{ {
$fetchMode = $fetchMode ?: $this->_defaultFetchMode; $fetchMode = $fetchMode ?: $this->_defaultFetchMode;
$rows = array(); $rows = [];
if (PDO::FETCH_COLUMN == $fetchMode) { if (PDO::FETCH_COLUMN == $fetchMode) {
while (($row = $this->fetchColumn()) !== false) { while (($row = $this->fetchColumn()) !== false) {
$rows[] = $row; $rows[] = $row;
......
...@@ -33,7 +33,7 @@ class Driver extends AbstractOracleDriver ...@@ -33,7 +33,7 @@ class Driver extends AbstractOracleDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
try { try {
return new OCI8Connection( return new OCI8Connection(
......
...@@ -54,12 +54,12 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -54,12 +54,12 @@ class OCI8Statement implements \IteratorAggregate, Statement
/** /**
* @var array * @var array
*/ */
protected static $fetchModeMap = array( protected static $fetchModeMap = [
PDO::FETCH_BOTH => OCI_BOTH, PDO::FETCH_BOTH => OCI_BOTH,
PDO::FETCH_ASSOC => OCI_ASSOC, PDO::FETCH_ASSOC => OCI_ASSOC,
PDO::FETCH_NUM => OCI_NUM, PDO::FETCH_NUM => OCI_NUM,
PDO::FETCH_COLUMN => OCI_NUM, PDO::FETCH_COLUMN => OCI_NUM,
); ];
/** /**
* @var integer * @var integer
...@@ -69,7 +69,7 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -69,7 +69,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
/** /**
* @var array * @var array
*/ */
protected $_paramMap = array(); protected $_paramMap = [];
/** /**
* Holds references to bound parameter values. * Holds references to bound parameter values.
...@@ -78,7 +78,7 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -78,7 +78,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
* *
* @var array * @var array
*/ */
private $boundValues = array(); private $boundValues = [];
/** /**
* Indicates whether the statement is in the state when fetching results is possible * Indicates whether the statement is in the state when fetching results is possible
...@@ -126,7 +126,7 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -126,7 +126,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
static public function convertPositionalToNamedPlaceholders($statement) static public function convertPositionalToNamedPlaceholders($statement)
{ {
$fragmentOffset = $tokenOffset = 0; $fragmentOffset = $tokenOffset = 0;
$fragments = $paramMap = array(); $fragments = $paramMap = [];
$currentLiteralDelimiter = null; $currentLiteralDelimiter = null;
do { do {
...@@ -154,7 +154,7 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -154,7 +154,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
$fragments[] = substr($statement, $fragmentOffset); $fragments[] = substr($statement, $fragmentOffset);
$statement = implode('', $fragments); $statement = implode('', $fragments);
return array($statement, $paramMap); return [$statement, $paramMap];
} }
/** /**
...@@ -409,7 +409,7 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -409,7 +409,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
{ {
$fetchMode = $fetchMode ?: $this->_defaultFetchMode; $fetchMode = $fetchMode ?: $this->_defaultFetchMode;
$result = array(); $result = [];
if (PDO::FETCH_OBJ == $fetchMode) { if (PDO::FETCH_OBJ == $fetchMode) {
while ($row = $this->fetch($fetchMode)) { while ($row = $this->fetch($fetchMode)) {
...@@ -436,7 +436,7 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -436,7 +436,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
// do not try fetching from the statement if it's not expected to contain result // do not try fetching from the statement if it's not expected to contain result
// in order to prevent exceptional situation // in order to prevent exceptional situation
if (!$this->result) { if (!$this->result) {
return array(); return [];
} }
oci_fetch_all($this->_sth, $result, 0, -1, oci_fetch_all($this->_sth, $result, 0, -1,
......
...@@ -41,7 +41,7 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection ...@@ -41,7 +41,7 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{ {
try { try {
parent::__construct($dsn, $user, $password, $options); parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine\DBAL\Driver\PDOStatement', array())); $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Doctrine\DBAL\Driver\PDOStatement', []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) { } catch (\PDOException $exception) {
throw new PDOException($exception); throw new PDOException($exception);
...@@ -71,7 +71,7 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection ...@@ -71,7 +71,7 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function prepare($prepareString, $driverOptions = array()) public function prepare($prepareString, $driverOptions = [])
{ {
try { try {
return parent::prepare($prepareString, $driverOptions); return parent::prepare($prepareString, $driverOptions);
......
...@@ -37,7 +37,7 @@ class Driver extends AbstractDB2Driver ...@@ -37,7 +37,7 @@ class Driver extends AbstractDB2Driver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
$conn = new PDOConnection( $conn = new PDOConnection(
$this->_constructPdoDsn($params), $this->_constructPdoDsn($params),
......
...@@ -34,7 +34,7 @@ class Driver extends AbstractMySQLDriver ...@@ -34,7 +34,7 @@ class Driver extends AbstractMySQLDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
try { try {
$conn = new PDOConnection( $conn = new PDOConnection(
......
...@@ -36,7 +36,7 @@ class Driver extends AbstractOracleDriver ...@@ -36,7 +36,7 @@ class Driver extends AbstractOracleDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
try { try {
return new PDOConnection( return new PDOConnection(
......
...@@ -35,7 +35,7 @@ class Driver extends AbstractPostgreSQLDriver ...@@ -35,7 +35,7 @@ class Driver extends AbstractPostgreSQLDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
try { try {
$pdo = new PDOConnection( $pdo = new PDOConnection(
......
...@@ -34,16 +34,16 @@ class Driver extends AbstractSQLiteDriver ...@@ -34,16 +34,16 @@ class Driver extends AbstractSQLiteDriver
/** /**
* @var array * @var array
*/ */
protected $_userDefinedFunctions = array( protected $_userDefinedFunctions = [
'sqrt' => array('callback' => array('Doctrine\DBAL\Platforms\SqlitePlatform', 'udfSqrt'), 'numArgs' => 1), 'sqrt' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfSqrt'], 'numArgs' => 1],
'mod' => array('callback' => array('Doctrine\DBAL\Platforms\SqlitePlatform', 'udfMod'), 'numArgs' => 2), 'mod' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfMod'], 'numArgs' => 2],
'locate' => array('callback' => array('Doctrine\DBAL\Platforms\SqlitePlatform', 'udfLocate'), 'numArgs' => -1), 'locate' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfLocate'], 'numArgs' => -1],
); ];
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
if (isset($driverOptions['userDefinedFunctions'])) { if (isset($driverOptions['userDefinedFunctions'])) {
$this->_userDefinedFunctions = array_merge( $this->_userDefinedFunctions = array_merge(
......
...@@ -34,7 +34,7 @@ class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connecti ...@@ -34,7 +34,7 @@ class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connecti
public function __construct($dsn, $user = null, $password = null, array $options = null) public function __construct($dsn, $user = null, $password = null, array $options = null)
{ {
parent::__construct($dsn, $user, $password, $options); parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array(Statement::class, array())); $this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]);
} }
/** /**
...@@ -47,7 +47,7 @@ class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connecti ...@@ -47,7 +47,7 @@ class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connecti
} }
$stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?'); $stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?');
$stmt->execute(array($name)); $stmt->execute([$name]);
return $stmt->fetchColumn(); return $stmt->fetchColumn();
} }
......
...@@ -31,7 +31,7 @@ class Driver extends AbstractSQLServerDriver ...@@ -31,7 +31,7 @@ class Driver extends AbstractSQLServerDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
return new Connection( return new Connection(
$this->_constructPdoDsn($params), $this->_constructPdoDsn($params),
......
...@@ -36,7 +36,7 @@ class Driver extends AbstractSQLAnywhereDriver ...@@ -36,7 +36,7 @@ class Driver extends AbstractSQLAnywhereDriver
* *
* @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection. * @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection.
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
try { try {
return new SQLAnywhereConnection( return new SQLAnywhereConnection(
...@@ -79,7 +79,7 @@ class Driver extends AbstractSQLAnywhereDriver ...@@ -79,7 +79,7 @@ class Driver extends AbstractSQLAnywhereDriver
* *
* @return string * @return string
*/ */
private function buildDsn($host, $port, $server, $dbname, $username = null, $password = null, array $driverOptions = array()) private function buildDsn($host, $port, $server, $dbname, $username = null, $password = null, array $driverOptions = [])
{ {
$host = $host ?: 'localhost'; $host = $host ?: 'localhost';
$port = $port ?: 2638; $port = $port ?: 2638;
......
...@@ -45,7 +45,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -45,7 +45,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
/** /**
* @var string Constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS. * @var string Constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
*/ */
private $defaultFetchClassCtorArgs = array(); private $defaultFetchClassCtorArgs = [];
/** /**
* @var int Default fetch mode to use. * @var int Default fetch mode to use.
...@@ -213,7 +213,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -213,7 +213,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
if (func_num_args() >= 2) { if (func_num_args() >= 2) {
$args = func_get_args(); $args = func_get_args();
$className = $args[1]; $className = $args[1];
$ctorArgs = isset($args[2]) ? $args[2] : array(); $ctorArgs = isset($args[2]) ? $args[2] : [];
} }
$result = sasql_fetch_object($this->result); $result = sasql_fetch_object($this->result);
...@@ -237,11 +237,11 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -237,11 +237,11 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
*/ */
public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
{ {
$rows = array(); $rows = [];
switch ($fetchMode) { switch ($fetchMode) {
case PDO::FETCH_CLASS: case PDO::FETCH_CLASS:
while ($row = call_user_func_array(array($this, 'fetch'), func_get_args())) { while ($row = call_user_func_array([$this, 'fetch'], func_get_args())) {
$rows[] = $row; $rows[] = $row;
} }
break; break;
...@@ -310,7 +310,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -310,7 +310,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
* *
* @throws SQLAnywhereException * @throws SQLAnywhereException
*/ */
private function castObject(\stdClass $sourceObject, $destinationClass, array $ctorArgs = array()) private function castObject(\stdClass $sourceObject, $destinationClass, array $ctorArgs = [])
{ {
if ( ! is_string($destinationClass)) { if ( ! is_string($destinationClass)) {
if ( ! is_object($destinationClass)) { if ( ! is_object($destinationClass)) {
......
...@@ -29,7 +29,7 @@ class Driver extends AbstractSQLServerDriver ...@@ -29,7 +29,7 @@ class Driver extends AbstractSQLServerDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
if (!isset($params['host'])) { if (!isset($params['host'])) {
throw new SQLSrvException("Missing 'host' in configuration for sqlsrv driver."); throw new SQLSrvException("Missing 'host' in configuration for sqlsrv driver.");
......
...@@ -134,7 +134,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection ...@@ -134,7 +134,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
{ {
if ($name !== null) { if ($name !== null) {
$stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?'); $stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?');
$stmt->execute(array($name)); $stmt->execute([$name]);
return $stmt->fetchColumn(); return $stmt->fetchColumn();
} }
......
...@@ -57,25 +57,25 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -57,25 +57,25 @@ class SQLSrvStatement implements IteratorAggregate, Statement
* *
* @var array * @var array
*/ */
private $variables = array(); private $variables = [];
/** /**
* Bound parameter types. * Bound parameter types.
* *
* @var array * @var array
*/ */
private $types = array(); private $types = [];
/** /**
* Translations. * Translations.
* *
* @var array * @var array
*/ */
private static $fetchMap = array( private static $fetchMap = [
PDO::FETCH_BOTH => SQLSRV_FETCH_BOTH, PDO::FETCH_BOTH => SQLSRV_FETCH_BOTH,
PDO::FETCH_ASSOC => SQLSRV_FETCH_ASSOC, PDO::FETCH_ASSOC => SQLSRV_FETCH_ASSOC,
PDO::FETCH_NUM => SQLSRV_FETCH_NUMERIC, PDO::FETCH_NUM => SQLSRV_FETCH_NUMERIC,
); ];
/** /**
* The name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS. * The name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
...@@ -89,7 +89,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -89,7 +89,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
* *
* @var string * @var string
*/ */
private $defaultFetchClassCtorArgs = array(); private $defaultFetchClassCtorArgs = [];
/** /**
* The fetch style. * The fetch style.
...@@ -254,16 +254,16 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -254,16 +254,16 @@ class SQLSrvStatement implements IteratorAggregate, Statement
*/ */
private function prepare() private function prepare()
{ {
$params = array(); $params = [];
foreach ($this->variables as $column => &$variable) { foreach ($this->variables as $column => &$variable) {
if (PDO::PARAM_LOB === $this->types[$column]) { if (PDO::PARAM_LOB === $this->types[$column]) {
$params[$column - 1] = array( $params[$column - 1] = [
&$variable, &$variable,
SQLSRV_PARAM_IN, SQLSRV_PARAM_IN,
SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY),
SQLSRV_SQLTYPE_VARBINARY('max'), SQLSRV_SQLTYPE_VARBINARY('max'),
); ];
} else { } else {
$params[$column - 1] =& $variable; $params[$column - 1] =& $variable;
} }
...@@ -320,13 +320,13 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -320,13 +320,13 @@ class SQLSrvStatement implements IteratorAggregate, Statement
return sqlsrv_fetch_array($this->stmt, self::$fetchMap[$fetchMode]) ?: false; return sqlsrv_fetch_array($this->stmt, self::$fetchMap[$fetchMode]) ?: false;
} }
if (in_array($fetchMode, array(PDO::FETCH_OBJ, PDO::FETCH_CLASS), true)) { if (in_array($fetchMode, [PDO::FETCH_OBJ, PDO::FETCH_CLASS], true)) {
$className = $this->defaultFetchClass; $className = $this->defaultFetchClass;
$ctorArgs = $this->defaultFetchClassCtorArgs; $ctorArgs = $this->defaultFetchClassCtorArgs;
if (count($args) >= 2) { if (count($args) >= 2) {
$className = $args[1]; $className = $args[1];
$ctorArgs = isset($args[2]) ? $args[2] : array(); $ctorArgs = isset($args[2]) ? $args[2] : [];
} }
return sqlsrv_fetch_object($this->stmt, $className, $ctorArgs) ?: false; return sqlsrv_fetch_object($this->stmt, $className, $ctorArgs) ?: false;
...@@ -340,11 +340,11 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -340,11 +340,11 @@ class SQLSrvStatement implements IteratorAggregate, Statement
*/ */
public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
{ {
$rows = array(); $rows = [];
switch ($fetchMode) { switch ($fetchMode) {
case PDO::FETCH_CLASS: case PDO::FETCH_CLASS:
while ($row = call_user_func_array(array($this, 'fetch'), func_get_args())) { while ($row = call_user_func_array([$this, 'fetch'], func_get_args())) {
$rows[] = $row; $rows[] = $row;
} }
break; break;
......
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