Skip to content

Commit

Permalink
fixed array short declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessandroMinoccheri committed Jul 25, 2017
1 parent 5cefa4d commit 80f42dc
Show file tree
Hide file tree
Showing 87 changed files with 504 additions and 503 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Cache/ArrayStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function fetch($fetchMode = null, $cursorOrientation = \PDO::FETCH_ORI_NE
*/
public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
{
$rows = array();
$rows = [];
while ($row = $this->fetch($fetchMode)) {
$rows[] = $row;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function closeCursor()
if ($this->emptied && $this->data !== null) {
$data = $this->resultCache->fetch($this->cacheKey);
if ( ! $data) {
$data = array();
$data = [];
}
$data[$this->realKey] = $this->data;

Expand Down Expand Up @@ -150,7 +150,7 @@ public function getIterator()
public function fetch($fetchMode = null, $cursorOrientation = \PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
{
if ($this->data === null) {
$this->data = array();
$this->data = [];
}

$row = $this->statement->fetch(PDO::FETCH_ASSOC);
Expand Down Expand Up @@ -181,7 +181,7 @@ public function fetch($fetchMode = null, $cursorOrientation = \PDO::FETCH_ORI_NE
*/
public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
{
$rows = array();
$rows = [];
while ($row = $this->fetch($fetchMode)) {
$rows[] = $row;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Configuration
*
* @var array
*/
protected $_attributes = array();
protected $_attributes = [];

/**
* Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled.
Expand Down
44 changes: 22 additions & 22 deletions lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class Connection implements DriverConnection
*
* @var array
*/
private $_params = array();
private $_params = [];

/**
* The DatabasePlatform object that provides information about the
Expand Down Expand Up @@ -355,7 +355,7 @@ public function connect()
}

$driverOptions = isset($this->_params['driverOptions']) ?
$this->_params['driverOptions'] : array();
$this->_params['driverOptions'] : [];
$user = isset($this->_params['user']) ? $this->_params['user'] : null;
$password = isset($this->_params['password']) ?
$this->_params['password'] : null;
Expand Down Expand Up @@ -546,7 +546,7 @@ public function setFetchMode($fetchMode)
*
* @return array|bool False is returned if no rows are found.
*/
public function fetchAssoc($statement, array $params = array(), array $types = array())
public function fetchAssoc($statement, array $params = [], array $types = [])
{
return $this->executeQuery($statement, $params, $types)->fetch(PDO::FETCH_ASSOC);
}
Expand All @@ -561,7 +561,7 @@ public function fetchAssoc($statement, array $params = array(), array $types = a
*
* @return array|bool False is returned if no rows are found.
*/
public function fetchArray($statement, array $params = array(), array $types = array())
public function fetchArray($statement, array $params = [], array $types = [])
{
return $this->executeQuery($statement, $params, $types)->fetch(PDO::FETCH_NUM);
}
Expand All @@ -577,7 +577,7 @@ public function fetchArray($statement, array $params = array(), array $types = a
*
* @return mixed|bool False is returned if no rows are found.
*/
public function fetchColumn($statement, array $params = array(), $column = 0, array $types = array())
public function fetchColumn($statement, array $params = [], $column = 0, array $types = [])
{
return $this->executeQuery($statement, $params, $types)->fetchColumn($column);
}
Expand Down Expand Up @@ -645,7 +645,7 @@ private function gatherConditions(array $identifiers)
*
* @throws InvalidArgumentException
*/
public function delete($tableExpression, array $identifier, array $types = array())
public function delete($tableExpression, array $identifier, array $types = [])
{
if (empty($identifier)) {
throw InvalidArgumentException::fromEmptyCriteria();
Expand Down Expand Up @@ -712,11 +712,11 @@ public function getTransactionIsolation()
*
* @return integer The number of affected rows.
*/
public function update($tableExpression, array $data, array $identifier, array $types = array())
public function update($tableExpression, array $data, array $identifier, array $types = [])
{
$setColumns = array();
$setValues = array();
$set = array();
$setColumns = [];
$setValues = [];
$set = [];

foreach ($data as $columnName => $value) {
$setColumns[] = $columnName;
Expand Down Expand Up @@ -749,15 +749,15 @@ public function update($tableExpression, array $data, array $identifier, array $
*
* @return integer The number of affected rows.
*/
public function insert($tableExpression, array $data, array $types = array())
public function insert($tableExpression, array $data, array $types = [])
{
if (empty($data)) {
return $this->executeUpdate('INSERT INTO ' . $tableExpression . ' ()' . ' VALUES ()');
}

$columns = array();
$values = array();
$set = array();
$columns = [];
$values = [];
$set = [];

foreach ($data as $columnName => $value) {
$columns[] = $columnName;
Expand All @@ -783,7 +783,7 @@ public function insert($tableExpression, array $data, array $types = array())
*/
private function extractTypeValues(array $columnList, array $types)
{
$typeValues = array();
$typeValues = [];

foreach ($columnList as $columnIndex => $columnName) {
$typeValues[] = isset($types[$columnName])
Expand Down Expand Up @@ -839,7 +839,7 @@ public function quote($input, $type = null)
*
* @return array
*/
public function fetchAll($sql, array $params = array(), $types = array())
public function fetchAll($sql, array $params = [], $types = [])
{
return $this->executeQuery($sql, $params, $types)->fetchAll();
}
Expand Down Expand Up @@ -881,7 +881,7 @@ public function prepare($statement)
*
* @throws \Doctrine\DBAL\DBALException
*/
public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null)
public function executeQuery($query, array $params = [], $types = [], QueryCacheProfile $qcp = null)
{
if ($qcp !== null) {
return $this->executeCacheQuery($query, $params, $types, $qcp);
Expand Down Expand Up @@ -948,7 +948,7 @@ public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qc
if (isset($data[$realKey])) {
$stmt = new ArrayStatement($data[$realKey]);
} elseif (array_key_exists($realKey, $data)) {
$stmt = new ArrayStatement(array());
$stmt = new ArrayStatement([]);
}
}

Expand All @@ -975,7 +975,7 @@ public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qc
*/
public function project($query, array $params, Closure $function)
{
$result = array();
$result = [];
$stmt = $this->executeQuery($query, $params);

while ($row = $stmt->fetch()) {
Expand Down Expand Up @@ -1034,7 +1034,7 @@ public function query()
*
* @throws \Doctrine\DBAL\DBALException
*/
public function executeUpdate($query, array $params = array(), array $types = array())
public function executeUpdate($query, array $params = [], array $types = [])
{
$this->connect();

Expand Down Expand Up @@ -1574,7 +1574,7 @@ private function getBindingInfo($value, $type)
$bindingType = $type; // PDO::PARAM_* constants
}

return array($value, $bindingType);
return [$value, $bindingType];
}

/**
Expand All @@ -1590,7 +1590,7 @@ private function getBindingInfo($value, $type)
*/
public function resolveParams(array $params, array $types)
{
$resolvedParams = array();
$resolvedParams = [];

// Check whether parameters are positional or named. Mixing is not allowed, just like in PDO.
if (is_int(key($params))) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public function close()
parent::close();

$this->_conn = null;
$this->connections = array('master' => null, 'slave' => null);
$this->connections = ['master' => null, 'slave' => null];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/DBALException.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static function unknownDriver($unknownDriverName, array $knownDrivers)
*
* @return \Doctrine\DBAL\DBALException
*/
public static function driverExceptionDuringQuery(Driver $driver, \Exception $driverEx, $sql, array $params = array())
public static function driverExceptionDuringQuery(Driver $driver, \Exception $driverEx, $sql, array $params = [])
{
$msg = "An exception occurred while executing '".$sql."'";
if ($params) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interface Driver
*
* @return \Doctrine\DBAL\Driver\Connection The database connection.
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = array());
public function connect(array $params, $username = null, $password = null, array $driverOptions = []);

/**
* Gets the DatabasePlatform instance that provides all the metadata about
Expand Down
10 changes: 5 additions & 5 deletions lib/Doctrine/DBAL/DriverManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class DriverManager
*
* @var array
*/
private static $_driverMap = array(
private static $_driverMap = [
'pdo_mysql' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
'pdo_sqlite' => 'Doctrine\DBAL\Driver\PDOSqlite\Driver',
'pdo_pgsql' => 'Doctrine\DBAL\Driver\PDOPgSql\Driver',
Expand All @@ -49,12 +49,12 @@ final class DriverManager
'drizzle_pdo_mysql' => 'Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver',
'sqlanywhere' => 'Doctrine\DBAL\Driver\SQLAnywhere\Driver',
'sqlsrv' => 'Doctrine\DBAL\Driver\SQLSrv\Driver',
);
];

/**
* List of URL schemes from a database URL and their mappings to driver.
*/
private static $driverSchemeAliases = array(
private static $driverSchemeAliases = [
'db2' => 'ibm_db2',
'mssql' => 'pdo_sqlsrv',
'mysql' => 'pdo_mysql',
Expand All @@ -64,7 +64,7 @@ final class DriverManager
'pgsql' => 'pdo_pgsql',
'sqlite' => 'pdo_sqlite',
'sqlite3' => 'pdo_sqlite',
);
];

/**
* Private constructor. This class cannot be instantiated.
Expand Down Expand Up @@ -334,7 +334,7 @@ private static function parseDatabaseUrlQuery(array $url, array $params)
return $params;
}

$query = array();
$query = [];

parse_str($url['query'], $query); // simply ingest query as extra params, e.g. charset or sslmode

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ public function postConnect(ConnectionEventArgs $args)
*/
public function getSubscribedEvents()
{
return array(Events::postConnect);
return [Events::postConnect];
}
}
10 changes: 5 additions & 5 deletions lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ class OracleSessionInit implements EventSubscriber
/**
* @var array
*/
protected $_defaultSessionVars = array(
protected $_defaultSessionVars = [
'NLS_TIME_FORMAT' => "HH24:MI:SS",
'NLS_DATE_FORMAT' => "YYYY-MM-DD HH24:MI:SS",
'NLS_TIMESTAMP_FORMAT' => "YYYY-MM-DD HH24:MI:SS",
'NLS_TIMESTAMP_TZ_FORMAT' => "YYYY-MM-DD HH24:MI:SS TZH:TZM",
'NLS_NUMERIC_CHARACTERS' => ".,",
);
];

/**
* @param array $oracleSessionVars
*/
public function __construct(array $oracleSessionVars = array())
public function __construct(array $oracleSessionVars = [])
{
$this->_defaultSessionVars = array_merge($this->_defaultSessionVars, $oracleSessionVars);
}
Expand All @@ -67,7 +67,7 @@ public function postConnect(ConnectionEventArgs $args)
{
if (count($this->_defaultSessionVars)) {
array_change_key_case($this->_defaultSessionVars, \CASE_UPPER);
$vars = array();
$vars = [];
foreach ($this->_defaultSessionVars as $option => $value) {
if ($option === 'CURRENT_SCHEMA') {
$vars[] = $option . " = " . $value;
Expand All @@ -85,6 +85,6 @@ public function postConnect(ConnectionEventArgs $args)
*/
public function getSubscribedEvents()
{
return array(Events::postConnect);
return [Events::postConnect];
}
}
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ public function postConnect(ConnectionEventArgs $args)
*/
public function getSubscribedEvents()
{
return array(Events::postConnect);
return [Events::postConnect];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private $_sql = array();
private $_sql = [];

/**
* @param \Doctrine\DBAL\Schema\Column $column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private $_sql = array();
private $_sql = [];

/**
* @param \Doctrine\DBAL\Schema\ColumnDiff $columnDiff
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs
/**
* @var array
*/
private $_sql = array();
private $_sql = [];

/**
* @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private $_sql = array();
private $_sql = [];

/**
* @param \Doctrine\DBAL\Schema\Column $column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private $_sql = array();
private $_sql = [];

/**
* @param string $oldColumnName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private $_sql = array();
private $_sql = [];

/**
* @param \Doctrine\DBAL\Schema\Column $column
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
/**
* @var array
*/
private $_sql = array();
private $_sql = [];

/**
* @param \Doctrine\DBAL\Schema\Table $table
Expand Down
Loading

0 comments on commit 80f42dc

Please sign in to comment.