From 80f42dc7afe91781e698e63b7d362b2f51986935 Mon Sep 17 00:00:00 2001 From: Alessandro Minoccheri Date: Tue, 25 Jul 2017 10:20:19 +0200 Subject: [PATCH] fixed array short declarations --- lib/Doctrine/DBAL/Cache/ArrayStatement.php | 2 +- .../DBAL/Cache/ResultCacheStatement.php | 6 +-- lib/Doctrine/DBAL/Configuration.php | 2 +- lib/Doctrine/DBAL/Connection.php | 44 ++++++++--------- .../Connections/MasterSlaveConnection.php | 2 +- lib/Doctrine/DBAL/DBALException.php | 2 +- lib/Doctrine/DBAL/Driver.php | 2 +- lib/Doctrine/DBAL/DriverManager.php | 10 ++-- .../DBAL/Event/Listeners/MysqlSessionInit.php | 2 +- .../Event/Listeners/OracleSessionInit.php | 10 ++-- .../DBAL/Event/Listeners/SQLSessionInit.php | 2 +- .../SchemaAlterTableAddColumnEventArgs.php | 2 +- .../SchemaAlterTableChangeColumnEventArgs.php | 2 +- .../DBAL/Event/SchemaAlterTableEventArgs.php | 2 +- .../SchemaAlterTableRemoveColumnEventArgs.php | 2 +- .../SchemaAlterTableRenameColumnEventArgs.php | 2 +- .../SchemaCreateTableColumnEventArgs.php | 2 +- .../DBAL/Event/SchemaCreateTableEventArgs.php | 2 +- lib/Doctrine/DBAL/Id/TableGenerator.php | 12 ++--- .../DBAL/Id/TableGeneratorSchemaVisitor.php | 4 +- lib/Doctrine/DBAL/Logging/DebugStack.php | 4 +- lib/Doctrine/DBAL/Logging/LoggerChain.php | 2 +- .../DBAL/Platforms/AbstractPlatform.php | 38 +++++++-------- lib/Doctrine/DBAL/Platforms/DB2Platform.php | 30 ++++++------ .../DBAL/Platforms/DrizzlePlatform.php | 16 +++---- .../DBAL/Platforms/Keywords/DB2Keywords.php | 4 +- .../Platforms/Keywords/DrizzleKeywords.php | 4 +- .../Platforms/Keywords/MySQL57Keywords.php | 4 +- .../DBAL/Platforms/Keywords/MySQLKeywords.php | 4 +- .../Platforms/Keywords/OracleKeywords.php | 4 +- .../Keywords/PostgreSQL91Keywords.php | 4 +- .../Keywords/PostgreSQL92Keywords.php | 4 +- .../Keywords/PostgreSQL94Keywords.php | 8 ++-- .../Platforms/Keywords/PostgreSQLKeywords.php | 4 +- .../Keywords/ReservedKeywordsValidator.php | 6 +-- .../Keywords/SQLAnywhere11Keywords.php | 6 +-- .../Keywords/SQLAnywhere12Keywords.php | 8 ++-- .../Keywords/SQLAnywhere16Keywords.php | 4 +- .../Keywords/SQLAnywhereKeywords.php | 4 +- .../Keywords/SQLServer2005Keywords.php | 4 +- .../Keywords/SQLServer2008Keywords.php | 4 +- .../Keywords/SQLServer2012Keywords.php | 4 +- .../Platforms/Keywords/SQLServerKeywords.php | 4 +- .../Platforms/Keywords/SQLiteKeywords.php | 4 +- .../DBAL/Platforms/MySQL57Platform.php | 8 ++-- lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 36 +++++++------- .../DBAL/Platforms/OraclePlatform.php | 36 +++++++------- .../DBAL/Platforms/PostgreSqlPlatform.php | 32 ++++++------- .../DBAL/Platforms/SQLAnywherePlatform.php | 24 +++++----- .../DBAL/Platforms/SQLServer2012Platform.php | 2 +- .../DBAL/Platforms/SQLServerPlatform.php | 30 ++++++------ .../DBAL/Platforms/SqlitePlatform.php | 40 ++++++++-------- lib/Doctrine/DBAL/Portability/Connection.php | 2 +- lib/Doctrine/DBAL/Portability/Statement.php | 2 +- lib/Doctrine/DBAL/Query/QueryBuilder.php | 8 ++-- lib/Doctrine/DBAL/SQLParserUtils.php | 18 +++---- lib/Doctrine/DBAL/Schema/AbstractAsset.php | 2 +- .../DBAL/Schema/AbstractSchemaManager.php | 48 +++++++++---------- lib/Doctrine/DBAL/Schema/Column.php | 10 ++-- lib/Doctrine/DBAL/Schema/ColumnDiff.php | 4 +- lib/Doctrine/DBAL/Schema/Comparator.php | 16 +++---- lib/Doctrine/DBAL/Schema/DB2SchemaManager.php | 22 ++++----- .../DBAL/Schema/DrizzleSchemaManager.php | 14 +++--- .../DBAL/Schema/ForeignKeyConstraint.php | 16 +++---- lib/Doctrine/DBAL/Schema/Index.php | 12 ++--- .../DBAL/Schema/MySqlSchemaManager.php | 28 +++++------ .../DBAL/Schema/OracleSchemaManager.php | 28 +++++------ .../DBAL/Schema/PostgreSqlSchemaManager.php | 26 +++++----- .../DBAL/Schema/SQLAnywhereSchemaManager.php | 23 ++++----- .../DBAL/Schema/SQLServerSchemaManager.php | 26 +++++----- lib/Doctrine/DBAL/Schema/Schema.php | 12 ++--- lib/Doctrine/DBAL/Schema/SchemaConfig.php | 2 +- lib/Doctrine/DBAL/Schema/SchemaDiff.php | 24 +++++----- .../DBAL/Schema/SqliteSchemaManager.php | 38 +++++++-------- lib/Doctrine/DBAL/Schema/Table.php | 36 +++++++------- lib/Doctrine/DBAL/Schema/TableDiff.php | 26 +++++----- .../Visitor/CreateSchemaSqlCollector.php | 16 +++---- .../Schema/Visitor/DropSchemaSqlCollector.php | 2 +- lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php | 8 ++-- .../SQLAzureFederationsSynchronizer.php | 4 +- .../SQLAzure/Schema/MultiTenantVisitor.php | 2 +- lib/Doctrine/DBAL/Statement.php | 8 ++-- .../Tools/Console/Command/ImportCommand.php | 4 +- .../Console/Command/ReservedWordsCommand.php | 8 ++-- lib/Doctrine/DBAL/Types/JsonArrayType.php | 2 +- lib/Doctrine/DBAL/Types/SimpleArrayType.php | 2 +- lib/Doctrine/DBAL/Types/Type.php | 8 ++-- 87 files changed, 504 insertions(+), 503 deletions(-) diff --git a/lib/Doctrine/DBAL/Cache/ArrayStatement.php b/lib/Doctrine/DBAL/Cache/ArrayStatement.php index 7417e9af3bf..bb9f2d6bf27 100644 --- a/lib/Doctrine/DBAL/Cache/ArrayStatement.php +++ b/lib/Doctrine/DBAL/Cache/ArrayStatement.php @@ -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; } diff --git a/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php b/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php index 7a5921d052a..3cf00952b7b 100644 --- a/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php +++ b/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php @@ -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; @@ -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); @@ -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; } diff --git a/lib/Doctrine/DBAL/Configuration.php b/lib/Doctrine/DBAL/Configuration.php index ec7c130619c..04136883d11 100644 --- a/lib/Doctrine/DBAL/Configuration.php +++ b/lib/Doctrine/DBAL/Configuration.php @@ -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. diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index 3b796a4e2fd..b439cdbc31e 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -153,7 +153,7 @@ class Connection implements DriverConnection * * @var array */ - private $_params = array(); + private $_params = []; /** * The DatabasePlatform object that provides information about the @@ -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; @@ -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); } @@ -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); } @@ -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); } @@ -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(); @@ -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; @@ -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; @@ -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]) @@ -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(); } @@ -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); @@ -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([]); } } @@ -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()) { @@ -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(); @@ -1574,7 +1574,7 @@ private function getBindingInfo($value, $type) $bindingType = $type; // PDO::PARAM_* constants } - return array($value, $bindingType); + return [$value, $bindingType]; } /** @@ -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))) { diff --git a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php index 4a91de6756e..8bb80efeb1c 100644 --- a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php +++ b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php @@ -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]; } /** diff --git a/lib/Doctrine/DBAL/DBALException.php b/lib/Doctrine/DBAL/DBALException.php index e571828ab1e..b697ed19e25 100644 --- a/lib/Doctrine/DBAL/DBALException.php +++ b/lib/Doctrine/DBAL/DBALException.php @@ -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) { diff --git a/lib/Doctrine/DBAL/Driver.php b/lib/Doctrine/DBAL/Driver.php index 21d60646640..300a27dec5b 100644 --- a/lib/Doctrine/DBAL/Driver.php +++ b/lib/Doctrine/DBAL/Driver.php @@ -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 diff --git a/lib/Doctrine/DBAL/DriverManager.php b/lib/Doctrine/DBAL/DriverManager.php index e3488df1e61..7f502232892 100644 --- a/lib/Doctrine/DBAL/DriverManager.php +++ b/lib/Doctrine/DBAL/DriverManager.php @@ -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', @@ -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', @@ -64,7 +64,7 @@ final class DriverManager 'pgsql' => 'pdo_pgsql', 'sqlite' => 'pdo_sqlite', 'sqlite3' => 'pdo_sqlite', - ); + ]; /** * Private constructor. This class cannot be instantiated. @@ -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 diff --git a/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php b/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php index bd362c4cb67..043f7b5ebc9 100644 --- a/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php +++ b/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php @@ -75,6 +75,6 @@ public function postConnect(ConnectionEventArgs $args) */ public function getSubscribedEvents() { - return array(Events::postConnect); + return [Events::postConnect]; } } diff --git a/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php b/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php index 1c7ddec2fe7..da22abc3c45 100644 --- a/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php +++ b/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php @@ -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); } @@ -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; @@ -85,6 +85,6 @@ public function postConnect(ConnectionEventArgs $args) */ public function getSubscribedEvents() { - return array(Events::postConnect); + return [Events::postConnect]; } } diff --git a/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php b/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php index cfa42994cb8..767c804821f 100644 --- a/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php +++ b/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php @@ -61,6 +61,6 @@ public function postConnect(ConnectionEventArgs $args) */ public function getSubscribedEvents() { - return array(Events::postConnect); + return [Events::postConnect]; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php index c4477ad8a1e..c9969cb7e37 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php @@ -50,7 +50,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs /** * @var array */ - private $_sql = array(); + private $_sql = []; /** * @param \Doctrine\DBAL\Schema\Column $column diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php index 7249b63cb66..6539de3d348 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php @@ -50,7 +50,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs /** * @var array */ - private $_sql = array(); + private $_sql = []; /** * @param \Doctrine\DBAL\Schema\ColumnDiff $columnDiff diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php index 384315d5a09..9ee9604c233 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php @@ -44,7 +44,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs /** * @var array */ - private $_sql = array(); + private $_sql = []; /** * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php index 06f37888ff3..cdea7ef1156 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php @@ -50,7 +50,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs /** * @var array */ - private $_sql = array(); + private $_sql = []; /** * @param \Doctrine\DBAL\Schema\Column $column diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php index 94a274c4fae..66431b698f4 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php @@ -55,7 +55,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs /** * @var array */ - private $_sql = array(); + private $_sql = []; /** * @param string $oldColumnName diff --git a/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php index 38b218257b9..a21fb73d26e 100644 --- a/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php @@ -50,7 +50,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs /** * @var array */ - private $_sql = array(); + private $_sql = []; /** * @param \Doctrine\DBAL\Schema\Column $column diff --git a/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php index 175b0e9c345..bb3f77acb25 100644 --- a/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php @@ -54,7 +54,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs /** * @var array */ - private $_sql = array(); + private $_sql = []; /** * @param \Doctrine\DBAL\Schema\Table $table diff --git a/lib/Doctrine/DBAL/Id/TableGenerator.php b/lib/Doctrine/DBAL/Id/TableGenerator.php index abf393ecaf9..275802ab097 100644 --- a/lib/Doctrine/DBAL/Id/TableGenerator.php +++ b/lib/Doctrine/DBAL/Id/TableGenerator.php @@ -76,7 +76,7 @@ class TableGenerator /** * @var array */ - private $sequences = array(); + private $sequences = []; /** * @param \Doctrine\DBAL\Connection $conn @@ -122,7 +122,7 @@ public function nextValue($sequenceName) $sql = "SELECT sequence_value, sequence_increment_by " . "FROM " . $platform->appendLockHint($this->generatorTableName, \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) . " " . "WHERE sequence_name = ? " . $platform->getWriteLockSQL(); - $stmt = $this->conn->executeQuery($sql, array($sequenceName)); + $stmt = $this->conn->executeQuery($sql, [$sequenceName]); if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $row = array_change_key_case($row, CASE_LOWER); @@ -131,16 +131,16 @@ public function nextValue($sequenceName) $value++; if ($row['sequence_increment_by'] > 1) { - $this->sequences[$sequenceName] = array( + $this->sequences[$sequenceName] = [ 'value' => $value, 'max' => $row['sequence_value'] + $row['sequence_increment_by'] - ); + ]; } $sql = "UPDATE " . $this->generatorTableName . " ". "SET sequence_value = sequence_value + sequence_increment_by " . "WHERE sequence_name = ? AND sequence_value = ?"; - $rows = $this->conn->executeUpdate($sql, array($sequenceName, $row['sequence_value'])); + $rows = $this->conn->executeUpdate($sql, [$sequenceName, $row['sequence_value']]); if ($rows != 1) { throw new \Doctrine\DBAL\DBALException("Race-condition detected while updating sequence. Aborting generation"); @@ -148,7 +148,7 @@ public function nextValue($sequenceName) } else { $this->conn->insert( $this->generatorTableName, - array('sequence_name' => $sequenceName, 'sequence_value' => 1, 'sequence_increment_by' => 1) + ['sequence_name' => $sequenceName, 'sequence_value' => 1, 'sequence_increment_by' => 1] ); $value = 1; } diff --git a/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php b/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php index 25b06aca9f2..619a92f7b4d 100644 --- a/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php +++ b/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php @@ -48,8 +48,8 @@ public function acceptSchema(Schema $schema) { $table = $schema->createTable($this->generatorTableName); $table->addColumn('sequence_name', 'string'); - $table->addColumn('sequence_value', 'integer', array('default' => 1)); - $table->addColumn('sequence_increment_by', 'integer', array('default' => 1)); + $table->addColumn('sequence_value', 'integer', ['default' => 1]); + $table->addColumn('sequence_increment_by', 'integer', ['default' => 1]); } /** diff --git a/lib/Doctrine/DBAL/Logging/DebugStack.php b/lib/Doctrine/DBAL/Logging/DebugStack.php index b143a3ee28e..77ed6cd6c25 100644 --- a/lib/Doctrine/DBAL/Logging/DebugStack.php +++ b/lib/Doctrine/DBAL/Logging/DebugStack.php @@ -36,7 +36,7 @@ class DebugStack implements SQLLogger * * @var array */ - public $queries = array(); + public $queries = []; /** * If Debug Stack is enabled (log queries) or not. @@ -62,7 +62,7 @@ public function startQuery($sql, array $params = null, array $types = null) { if ($this->enabled) { $this->start = microtime(true); - $this->queries[++$this->currentQuery] = array('sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0); + $this->queries[++$this->currentQuery] = ['sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0]; } } diff --git a/lib/Doctrine/DBAL/Logging/LoggerChain.php b/lib/Doctrine/DBAL/Logging/LoggerChain.php index 81845b1b250..fee05a4a004 100644 --- a/lib/Doctrine/DBAL/Logging/LoggerChain.php +++ b/lib/Doctrine/DBAL/Logging/LoggerChain.php @@ -31,7 +31,7 @@ class LoggerChain implements SQLLogger /** * @var \Doctrine\DBAL\Logging\SQLLogger[] */ - private $loggers = array(); + private $loggers = []; /** * Adds a logger in the chain. diff --git a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php index 3784fcb6501..1cf6c069320 100644 --- a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php @@ -457,7 +457,7 @@ public function hasDoctrineTypeMappingFor($dbType) */ protected function initializeCommentedDoctrineTypes() { - $this->doctrineTypeComments = array(); + $this->doctrineTypeComments = []; foreach (Type::getTypesMap() as $typeName => $className) { $type = Type::getType($typeName); @@ -607,7 +607,7 @@ public function getBinaryDefaultLength() */ public function getWildcards() { - return array('%', '_'); + return ['%', '_']; } /** @@ -1518,9 +1518,9 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE $tableName = $table->getQuotedName($this); $options = $table->getOptions(); - $options['uniqueConstraints'] = array(); - $options['indexes'] = array(); - $options['primary'] = array(); + $options['uniqueConstraints'] = []; + $options['indexes'] = []; + $options['primary'] = []; if (($createFlags&self::CREATE_INDEXES) > 0) { foreach ($table->getIndexes() as $index) { @@ -1534,8 +1534,8 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE } } - $columnSql = array(); - $columns = array(); + $columnSql = []; + $columns = []; foreach ($table->getColumns() as $column) { /* @var \Doctrine\DBAL\Schema\Column $column */ @@ -1568,7 +1568,7 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE } if (($createFlags&self::CREATE_FOREIGNKEYS) > 0) { - $options['foreignKeys'] = array(); + $options['foreignKeys'] = []; foreach ($table->getForeignKeys() as $fkConstraint) { $options['foreignKeys'][] = $fkConstraint; } @@ -1641,7 +1641,7 @@ public function getInlineColumnCommentSQL($comment) * * @return array */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = array()) + protected function _getCreateTableSQL($tableName, array $columns, array $options = []) { $columnListSql = $this->getColumnDeclarationListSQL($columns); @@ -1860,7 +1860,7 @@ public function getCreateSchemaSQL($schemaName) public function quoteIdentifier($str) { if (strpos($str, ".") !== false) { - $parts = array_map(array($this, "quoteSingleIdentifier"), explode(".", $str)); + $parts = array_map([$this, "quoteSingleIdentifier"], explode(".", $str)); return implode(".", $parts); } @@ -2051,7 +2051,7 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) { $tableName = $diff->getName($this)->getQuotedName($this); - $sql = array(); + $sql = []; if ($this->supportsForeignKeyConstraints()) { foreach ($diff->removedForeignKeys as $foreignKey) { $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName); @@ -2082,7 +2082,7 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) ? $diff->getNewName()->getQuotedName($this) : $diff->getName($this)->getQuotedName($this); - $sql = array(); + $sql = []; if ($this->supportsForeignKeyConstraints()) { foreach ($diff->addedForeignKeys as $foreignKey) { @@ -2124,10 +2124,10 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) */ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) { - return array( + return [ $this->getDropIndexSQL($oldIndexName, $tableName), $this->getCreateIndexSQL($index, $tableName) - ); + ]; } /** @@ -2173,7 +2173,7 @@ protected function _getAlterTableIndexForeignKeySQL(TableDiff $diff) */ public function getColumnDeclarationListSQL(array $fields) { - $queryFields = array(); + $queryFields = []; foreach ($fields as $fieldName => $field) { $queryFields[] = $this->getColumnDeclarationSQL($fieldName, $field); @@ -2279,9 +2279,9 @@ public function getDefaultValueDeclarationSQL($field) if (isset($field['default'])) { $default = " DEFAULT '".$field['default']."'"; if (isset($field['type'])) { - if (in_array((string) $field['type'], array("Integer", "BigInt", "SmallInt"))) { + if (in_array((string) $field['type'], ["Integer", "BigInt", "SmallInt"])) { $default = " DEFAULT ".$field['default']; - } elseif (in_array((string) $field['type'], array('DateTime', 'DateTimeTz')) && $field['default'] == $this->getCurrentTimestampSQL()) { + } elseif (in_array((string) $field['type'], ['DateTime', 'DateTimeTz']) && $field['default'] == $this->getCurrentTimestampSQL()) { $default = " DEFAULT ".$this->getCurrentTimestampSQL(); } elseif ((string) $field['type'] == 'Time' && $field['default'] == $this->getCurrentTimeSQL()) { $default = " DEFAULT ".$this->getCurrentTimeSQL(); @@ -2306,7 +2306,7 @@ public function getDefaultValueDeclarationSQL($field) */ public function getCheckDeclarationSQL(array $definition) { - $constraints = array(); + $constraints = []; foreach ($definition as $field => $def) { if (is_string($def)) { $constraints[] = 'CHECK (' . $def . ')'; @@ -2398,7 +2398,7 @@ public function getCustomTypeDeclarationSQL(array $columnDef) */ public function getIndexFieldDeclarationListSQL(array $fields) { - $ret = array(); + $ret = []; foreach ($fields as $field => $definition) { if (is_array($definition)) { diff --git a/lib/Doctrine/DBAL/Platforms/DB2Platform.php b/lib/Doctrine/DBAL/Platforms/DB2Platform.php index cac98333ea3..4afdbe8eed2 100644 --- a/lib/Doctrine/DBAL/Platforms/DB2Platform.php +++ b/lib/Doctrine/DBAL/Platforms/DB2Platform.php @@ -59,7 +59,7 @@ public function getBlobTypeDeclarationSQL(array $field) */ public function initializeDoctrineTypeMappings() { - $this->doctrineTypeMapping = array( + $this->doctrineTypeMapping = [ 'smallint' => 'smallint', 'bigint' => 'bigint', 'integer' => 'integer', @@ -75,7 +75,7 @@ public function initializeDoctrineTypeMappings() 'double' => 'float', 'real' => 'float', 'timestamp' => 'datetime', - ); + ]; } /** @@ -477,13 +477,13 @@ public function getIndexDeclarationSQL($name, Index $index) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = array()) + protected function _getCreateTableSQL($tableName, array $columns, array $options = []) { - $indexes = array(); + $indexes = []; if (isset($options['indexes'])) { $indexes = $options['indexes']; } - $options['indexes'] = array(); + $options['indexes'] = []; $sqls = parent::_getCreateTableSQL($tableName, $columns, $options); @@ -498,11 +498,11 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options */ public function getAlterTableSQL(TableDiff $diff) { - $sql = array(); - $columnSql = array(); - $commentsSQL = array(); + $sql = []; + $columnSql = []; + $commentsSQL = []; - $queryParts = array(); + $queryParts = []; foreach ($diff->addedColumns as $column) { if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { continue; @@ -571,7 +571,7 @@ public function getAlterTableSQL(TableDiff $diff) ' TO ' . $column->getQuotedName($this); } - $tableSql = array(); + $tableSql = []; if ( ! $this->onSchemaAlterTable($diff, $tableSql)) { if (count($queryParts) > 0) { @@ -644,10 +644,10 @@ private function getAlterColumnClausesSQL(ColumnDiff $columnDiff) $alterClause = 'ALTER COLUMN ' . $columnDiff->column->getQuotedName($this); if ($column['columnDefinition']) { - return array($alterClause . ' ' . $column['columnDefinition']); + return [$alterClause . ' ' . $column['columnDefinition']]; } - $clauses = array(); + $clauses = []; if ($columnDiff->hasChanged('type') || $columnDiff->hasChanged('length') || @@ -682,7 +682,7 @@ private function getAlterColumnClausesSQL(ColumnDiff $columnDiff) */ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) { - $sql = array(); + $sql = []; $table = $diff->getName($this)->getQuotedName($this); foreach ($diff->removedIndexes as $remKey => $remIndex) { @@ -721,7 +721,7 @@ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) $oldIndexName = $schema . '.' . $oldIndexName; } - return array('RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this)); + return ['RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this)]; } /** @@ -771,7 +771,7 @@ public function getTemporaryTableName($tableName) */ protected function doModifyLimitQuery($query, $limit, $offset = null) { - $where = array(); + $where = []; if ($offset > 0) { $where[] = sprintf('db22.DC_ROWNUM >= %d', $offset + 1); diff --git a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php index 851e5aad9b3..86e3ea070ec 100644 --- a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php @@ -142,7 +142,7 @@ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) */ protected function initializeDoctrineTypeMappings() { - $this->doctrineTypeMapping = array( + $this->doctrineTypeMapping = [ 'boolean' => 'boolean', 'varchar' => 'string', 'varbinary' => 'binary', @@ -156,7 +156,7 @@ protected function initializeDoctrineTypeMappings() 'timestamp' => 'datetime', 'double' => 'float', 'bigint' => 'bigint', - ); + ]; } /** @@ -194,7 +194,7 @@ public function getDropDatabaseSQL($name) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = array()) + protected function _getCreateTableSQL($tableName, array $columns, array $options = []) { $queryFields = $this->getColumnDeclarationListSQL($columns); @@ -251,7 +251,7 @@ private function buildTableOptions(array $options) return $options['table_options']; } - $tableOptions = array(); + $tableOptions = []; // Collate if ( ! isset($options['collate'])) { @@ -483,8 +483,8 @@ public function getDateTypeDeclarationSQL(array $fieldDeclaration) */ public function getAlterTableSQL(TableDiff $diff) { - $columnSql = array(); - $queryParts = array(); + $columnSql = []; + $queryParts = []; if ($diff->newName !== false) { $queryParts[] = 'RENAME TO ' . $diff->getNewName()->getQuotedName($this); @@ -545,8 +545,8 @@ public function getAlterTableSQL(TableDiff $diff) . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); } - $sql = array(); - $tableSql = array(); + $sql = []; + $tableSql = []; if ( ! $this->onSchemaAlterTable($diff, $tableSql)) { if (count($queryParts) > 0) { diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php index ff8aac81c6e..884cc8ec775 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php @@ -41,7 +41,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ACTIVATE', 'ADD', 'AFTER', @@ -436,6 +436,6 @@ protected function getKeywords() 'LOCATORS', 'ROLLBACK', 'YEARS', - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php index 21d59d8c587..46c8b246339 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php @@ -39,7 +39,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ABS', 'ALL', 'ALLOCATE', @@ -340,6 +340,6 @@ protected function getKeywords() 'XMLROOT', 'XMLSERIALIZE', 'YEAR', - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php index ae2f5bc7344..ef7c389ed3a 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php @@ -43,7 +43,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ACCESSIBLE', 'ADD', 'ALL', @@ -279,6 +279,6 @@ protected function getKeywords() 'XOR', 'YEAR_MONTH', 'ZEROFILL', - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php index fad3aa15393..8ba9b4d74ac 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php @@ -42,7 +42,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ACCESSIBLE', 'ADD', 'ALL', @@ -282,6 +282,6 @@ protected function getKeywords() 'XOR', 'YEAR_MONTH', 'ZEROFILL', - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php index b37fdad3deb..4914d2e9db4 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php @@ -42,7 +42,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ACCESS', 'ELSE', 'MODIFY', @@ -156,6 +156,6 @@ protected function getKeywords() 'ROWS', 'WITH', 'RANGE', - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php index 4e5c632d358..ecbd0a46db0 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php @@ -44,7 +44,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ALL', 'ANALYSE', 'ANALYZE', @@ -143,6 +143,6 @@ protected function getKeywords() 'WHERE', 'WINDOW', 'WITH', - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php index 7180dfd9834..7ce91ed0522 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php @@ -43,8 +43,8 @@ public function getName() */ protected function getKeywords() { - return array_merge(parent::getKeywords(), array( + return array_merge(parent::getKeywords(), [ 'COLLATION', - )); + ]); } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php index dfb2a0633d7..0e2d9c5ac2b 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php @@ -43,12 +43,12 @@ public function getName() */ protected function getKeywords() { - $parentKeywords = array_diff(parent::getKeywords(), array( + $parentKeywords = array_diff(parent::getKeywords(), [ 'OVER', - )); + ]); - return array_merge($parentKeywords, array( + return array_merge($parentKeywords, [ 'LATERAL', - )); + ]); } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php index 9e49d7f2504..571d6f4e818 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php @@ -42,7 +42,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ALL', 'ANALYSE', 'ANALYZE', @@ -130,6 +130,6 @@ protected function getKeywords() 'VERBOSE', 'WHEN', 'WHERE' - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php b/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php index e1fdd492d8c..cb35aba47e5 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php @@ -32,12 +32,12 @@ class ReservedKeywordsValidator implements Visitor /** * @var KeywordList[] */ - private $keywordLists = array(); + private $keywordLists = []; /** * @var array */ - private $violations = array(); + private $violations = []; /** * @param \Doctrine\DBAL\Platforms\Keywords\KeywordList[] $keywordLists @@ -66,7 +66,7 @@ private function isReservedWord($word) $word = str_replace('`', '', $word); } - $keywordLists = array(); + $keywordLists = []; foreach ($this->keywordLists as $keywordList) { if ($keywordList->isKeyword($word)) { $keywordLists[] = $keywordList->getName(); diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php index 12eacbf9b9b..fbbdc40fd55 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php @@ -44,12 +44,12 @@ protected function getKeywords() return array_merge( array_diff( parent::getKeywords(), - array('IQ') + ['IQ'] ), - array( + [ 'MERGE', 'OPENSTRING' - ) + ] ); } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere12Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere12Keywords.php index 22e04893e98..7367fc82fb4 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere12Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere12Keywords.php @@ -44,21 +44,21 @@ protected function getKeywords() return array_merge( array_diff( parent::getKeywords(), - array( + [ 'INDEX_LPAREN', 'SYNTAX_ERROR', 'WITH_CUBE', 'WITH_LPAREN', 'WITH_ROLLUP' - ) + ] ), - array( + [ 'DATETIMEOFFSET', 'LIMIT', 'OPENXML', 'SPATIAL', 'TREAT' - ) + ] ); } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere16Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere16Keywords.php index 4d78b84109f..5f3883a4271 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere16Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere16Keywords.php @@ -43,14 +43,14 @@ protected function getKeywords() { return array_merge( parent::getKeywords(), - array( + [ 'ARRAY', 'JSON', 'ROW', 'ROWTYPE', 'UNNEST', 'VARRAY' - ) + ] ); } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhereKeywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhereKeywords.php index cabf1e44914..9d5ab5db870 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhereKeywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhereKeywords.php @@ -41,7 +41,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ADD', 'ALL', 'ALTER', @@ -276,6 +276,6 @@ protected function getKeywords() 'WORK', 'WRITETEXT', 'XML' - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php index 3a7434910f3..18cb83a1bd8 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php @@ -44,13 +44,13 @@ public function getName() */ protected function getKeywords() { - return array_merge(array_diff(parent::getKeywords(), array('DUMMY')), array( + return array_merge(array_diff(parent::getKeywords(), ['DUMMY']), [ 'EXTERNAL', 'PIVOT', 'REVERT', 'SECURITYAUDIT', 'TABLESAMPLE', 'UNPIVOT' - )); + ]); } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php index 38556b50557..6aa586e8818 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php @@ -44,8 +44,8 @@ public function getName() */ protected function getKeywords() { - return array_merge(parent::getKeywords(), array( + return array_merge(parent::getKeywords(), [ 'MERGE' - )); + ]); } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php index ada1c026bd7..9eabada0c9c 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php @@ -44,12 +44,12 @@ public function getName() */ protected function getKeywords() { - return array_merge(parent::getKeywords(), array( + return array_merge(parent::getKeywords(), [ 'SEMANTICKEYPHRASETABLE', 'SEMANTICSIMILARITYDETAILSTABLE', 'SEMANTICSIMILARITYTABLE', 'TRY_CONVERT', 'WITHIN GROUP' - )); + ]); } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php index fb43d2d5313..5b65cbc8721 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php @@ -46,7 +46,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ADD', 'ALL', 'ALTER', @@ -226,6 +226,6 @@ protected function getKeywords() 'WHILE', 'WITH', 'WRITETEXT' - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php b/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php index a162d3d5396..f240aa64469 100644 --- a/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php +++ b/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php @@ -41,7 +41,7 @@ public function getName() */ protected function getKeywords() { - return array( + return [ 'ABORT', 'ACTION', 'ADD', @@ -163,6 +163,6 @@ protected function getKeywords() 'VIRTUAL', 'WHEN', 'WHERE' - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php b/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php index 44132a74326..5b2328b2e65 100644 --- a/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php +++ b/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php @@ -54,7 +54,7 @@ public function getJsonTypeDeclarationSQL(array $field) */ protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) { - return array(); + return []; } /** @@ -62,7 +62,7 @@ protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) */ protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff) { - return array(); + return []; } /** @@ -70,9 +70,9 @@ protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff) */ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) { - return array( + return [ 'ALTER TABLE ' . $tableName . ' RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this) - ); + ]; } /** diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index eb4b4ff53e0..5d2b6339dac 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -409,7 +409,7 @@ public function getDropDatabaseSQL($name) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = array()) + protected function _getCreateTableSQL($tableName, array $columns, array $options = []) { $queryFields = $this->getColumnDeclarationListSQL($columns); @@ -485,7 +485,7 @@ private function buildTableOptions(array $options) return $options['table_options']; } - $tableOptions = array(); + $tableOptions = []; // Charset if ( ! isset($options['charset'])) { @@ -547,8 +547,8 @@ private function buildPartitionOptions(array $options) */ public function getAlterTableSQL(TableDiff $diff) { - $columnSql = array(); - $queryParts = array(); + $columnSql = []; + $queryParts = []; if ($diff->newName !== false) { $queryParts[] = 'RENAME TO ' . $diff->getNewName()->getQuotedName($this); } @@ -611,8 +611,8 @@ public function getAlterTableSQL(TableDiff $diff) unset($diff->addedIndexes['primary']); } - $sql = array(); - $tableSql = array(); + $sql = []; + $tableSql = []; if ( ! $this->onSchemaAlterTable($diff, $tableSql)) { if (count($queryParts) > 0) { @@ -633,7 +633,7 @@ public function getAlterTableSQL(TableDiff $diff) */ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) { - $sql = array(); + $sql = []; $table = $diff->getName($this)->getQuotedName($this); foreach ($diff->changedIndexes as $changedIndex) { @@ -676,9 +676,9 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) // Suppress foreign key constraint propagation on non-supporting engines. if ('INNODB' !== $engine) { - $diff->addedForeignKeys = array(); - $diff->changedForeignKeys = array(); - $diff->removedForeignKeys = array(); + $diff->addedForeignKeys = []; + $diff->changedForeignKeys = []; + $diff->removedForeignKeys = []; } $sql = array_merge( @@ -699,7 +699,7 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) */ private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $index) { - $sql = array(); + $sql = []; if (! $index->isPrimary() || ! $diff->fromTable instanceof Table) { return $sql; @@ -736,7 +736,7 @@ private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $inde */ private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff) { - $sql = array(); + $sql = []; $table = $diff->getName($this)->getQuotedName($this); foreach ($diff->changedIndexes as $changedIndex) { @@ -772,7 +772,7 @@ private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff) */ protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) { - $sql = array(); + $sql = []; $tableName = $diff->getName($this)->getQuotedName($this); foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) { @@ -797,10 +797,10 @@ protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) private function getRemainingForeignKeyConstraintsRequiringRenamedIndexes(TableDiff $diff) { if (empty($diff->renamedIndexes) || ! $diff->fromTable instanceof Table) { - return array(); + return []; } - $foreignKeys = array(); + $foreignKeys = []; /** @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[] $remainingForeignKeys */ $remainingForeignKeys = array_diff_key( $diff->fromTable->getForeignKeys(), @@ -838,7 +838,7 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) */ protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff) { - $sql = array(); + $sql = []; $tableName = (false !== $diff->newName) ? $diff->getNewName()->getQuotedName($this) : $diff->getName($this)->getQuotedName($this); @@ -1015,7 +1015,7 @@ public function getReadLockSQL() */ protected function initializeDoctrineTypeMappings() { - $this->doctrineTypeMapping = array( + $this->doctrineTypeMapping = [ 'tinyint' => 'boolean', 'smallint' => 'smallint', 'mediumint' => 'integer', @@ -1046,7 +1046,7 @@ protected function initializeDoctrineTypeMappings() 'binary' => 'binary', 'varbinary' => 'binary', 'set' => 'simple_array', - ); + ]; } /** diff --git a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php index a0b01a853f7..8d200150872 100644 --- a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php @@ -384,10 +384,10 @@ public function getListSequencesSQL($database) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($table, array $columns, array $options = array()) + protected function _getCreateTableSQL($table, array $columns, array $options = []) { - $indexes = isset($options['indexes']) ? $options['indexes'] : array(); - $options['indexes'] = array(); + $indexes = isset($options['indexes']) ? $options['indexes'] : []; + $options['indexes'] = []; $sql = parent::_getCreateTableSQL($table, $columns, $options); foreach ($columns as $name => $column) { @@ -499,11 +499,11 @@ public function getCreateAutoincrementSql($name, $table, $start = 1) $quotedName = $nameIdentifier->getQuotedName($this); $unquotedName = $nameIdentifier->getName(); - $sql = array(); + $sql = []; $autoincrementIdentifierName = $this->getAutoincrementIdentifierName($tableIdentifier); - $idx = new Index($autoincrementIdentifierName, array($quotedName), true, true); + $idx = new Index($autoincrementIdentifierName, [$quotedName], true, true); $sql[] = 'DECLARE constraints_Count NUMBER; @@ -562,11 +562,11 @@ public function getDropAutoincrementSql($table) '' ); - return array( + return [ 'DROP TRIGGER ' . $autoincrementIdentifierName, $this->getDropSequenceSQL($identitySequenceName), $this->getDropConstraintSQL($autoincrementIdentifierName, $table->getQuotedName($this)), - ); + ]; } /** @@ -764,11 +764,11 @@ public function getDropDatabaseSQL($database) */ public function getAlterTableSQL(TableDiff $diff) { - $sql = array(); - $commentsSQL = array(); - $columnSql = array(); + $sql = []; + $commentsSQL = []; + $columnSql = []; - $fields = array(); + $fields = []; foreach ($diff->addedColumns as $column) { if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { @@ -789,7 +789,7 @@ public function getAlterTableSQL(TableDiff $diff) $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ADD (' . implode(', ', $fields) . ')'; } - $fields = array(); + $fields = []; foreach ($diff->changedColumns as $columnDiff) { if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { continue; @@ -847,7 +847,7 @@ public function getAlterTableSQL(TableDiff $diff) ' RENAME COLUMN ' . $oldColumnName->getQuotedName($this) .' TO ' . $column->getQuotedName($this); } - $fields = array(); + $fields = []; foreach ($diff->removedColumns as $column) { if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { continue; @@ -860,7 +860,7 @@ public function getAlterTableSQL(TableDiff $diff) $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' DROP (' . implode(', ', $fields).')'; } - $tableSql = array(); + $tableSql = []; if ( ! $this->onSchemaAlterTable($diff, $tableSql)) { $sql = array_merge($sql, $commentsSQL); @@ -918,7 +918,7 @@ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) $oldIndexName = $schema . '.' . $oldIndexName; } - return array('ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)); + return ['ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)]; } /** @@ -986,7 +986,7 @@ protected function doModifyLimitQuery($query, $limit, $offset = null) $query .= " FROM dual"; } - $columns = array('a.*'); + $columns = ['a.*']; if ($offset > 0) { $columns[] = 'ROWNUM AS doctrine_rownum'; @@ -1116,7 +1116,7 @@ public function getDummySelectSQL() */ protected function initializeDoctrineTypeMappings() { - $this->doctrineTypeMapping = array( + $this->doctrineTypeMapping = [ 'integer' => 'integer', 'number' => 'integer', 'pls_integer' => 'boolean', @@ -1140,7 +1140,7 @@ protected function initializeDoctrineTypeMappings() 'rowid' => 'string', 'urowid' => 'string', 'blob' => 'blob', - ); + ]; } /** diff --git a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php index d1220df089d..695a11dc8d7 100644 --- a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php @@ -47,24 +47,24 @@ class PostgreSqlPlatform extends AbstractPlatform /** * @var array PostgreSQL booleans literals */ - private $booleanLiterals = array( - 'true' => array( + private $booleanLiterals = [ + 'true' => [ 't', 'true', 'y', 'yes', 'on', '1' - ), - 'false' => array( + ], + 'false' => [ 'f', 'false', 'n', 'no', 'off', '0' - ) - ); + ] + ]; /** * PostgreSQL has different behavior with some drivers @@ -486,9 +486,9 @@ public function getAdvancedForeignKeyOptionsSQL(\Doctrine\DBAL\Schema\ForeignKey */ public function getAlterTableSQL(TableDiff $diff) { - $sql = array(); - $commentsSQL = array(); - $columnSql = array(); + $sql = []; + $commentsSQL = []; + $columnSql = []; foreach ($diff->addedColumns as $column) { if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { @@ -593,7 +593,7 @@ public function getAlterTableSQL(TableDiff $diff) ' RENAME COLUMN ' . $oldColumnName->getQuotedName($this) . ' TO ' . $column->getQuotedName($this); } - $tableSql = array(); + $tableSql = []; if ( ! $this->onSchemaAlterTable($diff, $tableSql)) { $sql = array_merge($sql, $commentsSQL); @@ -643,14 +643,14 @@ private function isUnchangedBinaryColumn(ColumnDiff $columnDiff) return false; } - return count(array_diff($columnDiff->changedProperties, array('type', 'length', 'fixed'))) === 0; + return count(array_diff($columnDiff->changedProperties, ['type', 'length', 'fixed'])) === 0; } if ($columnDiff->hasChanged('type')) { return false; } - return count(array_diff($columnDiff->changedProperties, array('length', 'fixed'))) === 0; + return count(array_diff($columnDiff->changedProperties, ['length', 'fixed'])) === 0; } /** @@ -663,7 +663,7 @@ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) $oldIndexName = $schema . '.' . $oldIndexName; } - return array('ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)); + return ['ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)]; } /** @@ -748,7 +748,7 @@ public function getDropForeignKeySQL($foreignKey, $table) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = array()) + protected function _getCreateTableSQL($tableName, array $columns, array $options = []) { $queryFields = $this->getColumnDeclarationListSQL($columns); @@ -1094,7 +1094,7 @@ public function getReadLockSQL() */ protected function initializeDoctrineTypeMappings() { - $this->doctrineTypeMapping = array( + $this->doctrineTypeMapping = [ 'smallint' => 'smallint', 'int2' => 'smallint', 'serial' => 'integer', @@ -1134,7 +1134,7 @@ protected function initializeDoctrineTypeMappings() 'year' => 'date', 'uuid' => 'guid', 'bytea' => 'blob', - ); + ]; } /** diff --git a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php index a55918bc6e5..5778db1729f 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php @@ -127,11 +127,11 @@ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey */ public function getAlterTableSQL(TableDiff $diff) { - $sql = array(); - $columnSql = array(); - $commentsSQL = array(); - $tableSql = array(); - $alterClauses = array(); + $sql = []; + $columnSql = []; + $commentsSQL = []; + $tableSql = []; + $alterClauses = []; /** @var \Doctrine\DBAL\Schema\Column $column */ foreach ($diff->addedColumns as $column) { @@ -1221,10 +1221,10 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) /** * {@inheritdoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = array()) + protected function _getCreateTableSQL($tableName, array $columns, array $options = []) { $columnListSql = $this->getColumnDeclarationListSQL($columns); - $indexSql = array(); + $indexSql = []; if ( ! empty($options['uniqueConstraints'])) { foreach ((array) $options['uniqueConstraints'] as $name => $definition) { @@ -1264,7 +1264,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options $query .= ')'; - return array_merge(array($query), $indexSql); + return array_merge([$query], $indexSql); } /** @@ -1419,9 +1419,9 @@ protected function getCreateIndexSQLFlags(Index $index) */ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) { - return array( + return [ 'ALTER INDEX ' . $oldIndexName . ' ON ' . $tableName . ' RENAME TO ' . $index->getQuotedName($this) - ); + ]; } /** @@ -1447,7 +1447,7 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) */ protected function initializeDoctrineTypeMappings() { - $this->doctrineTypeMapping = array( + $this->doctrineTypeMapping = [ 'char' => 'string', 'long nvarchar' => 'text', 'long varchar' => 'text', @@ -1486,6 +1486,6 @@ protected function initializeDoctrineTypeMappings() 'long binary' => 'blob', 'uniqueidentifier' => 'guid', 'varbinary' => 'binary', - ); + ]; } } diff --git a/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php b/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php index 4cdff77bf78..1fcb8a4dad1 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php @@ -116,7 +116,7 @@ protected function doModifyLimitQuery($query, $limit, $offset = null) // Queries using OFFSET... FETCH MUST have an ORDER BY clause // Find the position of the last instance of ORDER BY and ensure it is not within a parenthetical statement // but can be in a newline - $matches = array(); + $matches = []; $matchesCount = preg_match_all("/[\\s]+order\\s+by\\s/im", $query, $matches, PREG_OFFSET_CAPTURE); $orderByPos = false; if ($matchesCount > 0) { diff --git a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php index d6bddbbdb90..481fb6d7c91 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php @@ -231,10 +231,10 @@ public function getDropIndexSQL($index, $table = null) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = array()) + protected function _getCreateTableSQL($tableName, array $columns, array $options = []) { - $defaultConstraintsSql = array(); - $commentsSql = array(); + $defaultConstraintsSql = []; + $commentsSql = []; // @todo does other code breaks because of this? // force primary keys to be not null @@ -419,7 +419,7 @@ protected function getCreateIndexSQLFlags(Index $index) */ private function _appendUniqueConstraintDefinition($sql, Index $index) { - $fields = array(); + $fields = []; foreach ($index->getQuotedColumns($this) as $field) { $fields[] = $field . ' IS NOT NULL'; @@ -433,10 +433,10 @@ private function _appendUniqueConstraintDefinition($sql, Index $index) */ public function getAlterTableSQL(TableDiff $diff) { - $queryParts = array(); - $sql = array(); - $columnSql = array(); - $commentsSql = array(); + $queryParts = []; + $sql = []; + $columnSql = []; + $commentsSql = []; /** @var \Doctrine\DBAL\Schema\Column $column */ foreach ($diff->addedColumns as $column) { @@ -548,7 +548,7 @@ public function getAlterTableSQL(TableDiff $diff) } } - $tableSql = array(); + $tableSql = []; if ($this->onSchemaAlterTable($diff, $tableSql)) { return array_merge($tableSql, $columnSql); @@ -725,14 +725,14 @@ protected function getDropColumnCommentSQL($tableName, $columnName) */ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) { - return array( + return [ sprintf( "EXEC sp_RENAME N'%s.%s', N'%s', N'INDEX'", $tableName, $oldIndexName, $index->getQuotedName($this) ) - ); + ]; } /** @@ -1413,7 +1413,7 @@ public function getName() */ protected function initializeDoctrineTypeMappings() { - $this->doctrineTypeMapping = array( + $this->doctrineTypeMapping = [ 'bigint' => 'bigint', 'numeric' => 'decimal', 'bit' => 'boolean', @@ -1439,7 +1439,7 @@ protected function initializeDoctrineTypeMappings() 'varbinary' => 'binary', 'image' => 'blob', 'uniqueidentifier' => 'guid', - ); + ]; } /** @@ -1554,11 +1554,11 @@ public function getDefaultValueDeclarationSQL($field) return " DEFAULT '" . $field['default'] . "'"; } - if (in_array((string) $field['type'], array('Integer', 'BigInt', 'SmallInt'))) { + if (in_array((string) $field['type'], ['Integer', 'BigInt', 'SmallInt'])) { return " DEFAULT " . $field['default']; } - if (in_array((string) $field['type'], array('DateTime', 'DateTimeTz')) && $field['default'] == $this->getCurrentTimestampSQL()) { + if (in_array((string) $field['type'], ['DateTime', 'DateTimeTz']) && $field['default'] == $this->getCurrentTimestampSQL()) { return " DEFAULT " . $this->getCurrentTimestampSQL(); } diff --git a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php index f52e384d8b3..16abd07feeb 100644 --- a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php @@ -315,7 +315,7 @@ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($name, array $columns, array $options = array()) + protected function _getCreateTableSQL($name, array $columns, array $options = []) { $name = str_replace('.', '__', $name); $queryFields = $this->getColumnDeclarationListSQL($columns); @@ -592,7 +592,7 @@ public function getInlineColumnCommentSQL($comment) */ protected function initializeDoctrineTypeMappings() { - $this->doctrineTypeMapping = array( + $this->doctrineTypeMapping = [ 'boolean' => 'boolean', 'tinyint' => 'boolean', 'smallint' => 'smallint', @@ -625,7 +625,7 @@ protected function initializeDoctrineTypeMappings() 'decimal' => 'decimal', 'numeric' => 'decimal', 'blob' => 'blob', - ); + ]; } /** @@ -645,7 +645,7 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) throw new DBALException('Sqlite platform requires for alter table the table diff with reference to original table schema'); } - $sql = array(); + $sql = []; foreach ($diff->fromTable->getIndexes() as $index) { if ( ! $index->isPrimary()) { $sql[] = $this->getDropIndexSQL($index, $diff->name); @@ -664,7 +664,7 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) throw new DBALException('Sqlite platform requires for alter table the table diff with reference to original table schema'); } - $sql = array(); + $sql = []; $tableName = $diff->newName ? $diff->getNewName(): $diff->getName($this); foreach ($this->getIndexesInAlteredTable($diff) as $index) { if ($index->isPrimary()) { @@ -799,10 +799,10 @@ public function getAlterTableSQL(TableDiff $diff) $table = clone $fromTable; - $columns = array(); - $oldColumnNames = array(); - $newColumnNames = array(); - $columnSql = array(); + $columns = []; + $oldColumnNames = []; + $newColumnNames = []; + $columnSql = []; foreach ($table->getColumns() as $columnName => $column) { $columnName = strtolower($columnName); @@ -864,8 +864,8 @@ public function getAlterTableSQL(TableDiff $diff) $columns[strtolower($columnName)] = $column; } - $sql = array(); - $tableSql = array(); + $sql = []; + $tableSql = []; if ( ! $this->onSchemaAlterTable($diff, $tableSql)) { $dataTable = new Table('__temp__'.$table->getName()); @@ -932,16 +932,16 @@ private function getSimpleAlterTableSQL(TableDiff $diff) $table = new Table($diff->name); - $sql = array(); - $tableSql = array(); - $columnSql = array(); + $sql = []; + $tableSql = []; + $columnSql = []; foreach ($diff->addedColumns as $column) { if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { continue; } - $field = array_merge(array('unique' => null, 'autoincrement' => null, 'default' => null), $column->toArray()); + $field = array_merge(['unique' => null, 'autoincrement' => null, 'default' => null], $column->toArray()); $type = (string) $field['type']; switch (true) { case isset($field['columnDefinition']) || $field['autoincrement'] || $field['unique']: @@ -976,7 +976,7 @@ private function getSimpleAlterTableSQL(TableDiff $diff) */ private function getColumnNamesInAlteredTable(TableDiff $diff) { - $columns = array(); + $columns = []; foreach ($diff->fromTable->getColumns() as $columnName => $column) { $columns[strtolower($columnName)] = $column->getName(); @@ -1026,7 +1026,7 @@ private function getIndexesInAlteredTable(TableDiff $diff) } $changed = false; - $indexColumns = array(); + $indexColumns = []; foreach ($index->getColumns() as $columnName) { $normalizedColumnName = strtolower($columnName); if ( ! isset($columnNames[$normalizedColumnName])) { @@ -1076,7 +1076,7 @@ private function getForeignKeysInAlteredTable(TableDiff $diff) foreach ($foreignKeys as $key => $constraint) { $changed = false; - $localColumns = array(); + $localColumns = []; foreach ($constraint->getLocalColumns() as $columnName) { $normalizedColumnName = strtolower($columnName); if ( ! isset($columnNames[$normalizedColumnName])) { @@ -1121,11 +1121,11 @@ private function getForeignKeysInAlteredTable(TableDiff $diff) */ private function getPrimaryIndexInAlteredTable(TableDiff $diff) { - $primaryIndex = array(); + $primaryIndex = []; foreach ($this->getIndexesInAlteredTable($diff) as $index) { if ($index->isPrimary()) { - $primaryIndex = array($index->getName() => $index); + $primaryIndex = [$index->getName() => $index]; } } diff --git a/lib/Doctrine/DBAL/Portability/Connection.php b/lib/Doctrine/DBAL/Portability/Connection.php index f6dccdbe130..3d2b84d50a8 100644 --- a/lib/Doctrine/DBAL/Portability/Connection.php +++ b/lib/Doctrine/DBAL/Portability/Connection.php @@ -115,7 +115,7 @@ public function getFetchCase() /** * {@inheritdoc} */ - public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null) + public function executeQuery($query, array $params = [], $types = [], QueryCacheProfile $qcp = null) { $stmt = new Statement(parent::executeQuery($query, $params, $types, $qcp), $this); $stmt->setFetchMode($this->defaultFetchMode); diff --git a/lib/Doctrine/DBAL/Portability/Statement.php b/lib/Doctrine/DBAL/Portability/Statement.php index 15741e37234..7970c1a5c6e 100644 --- a/lib/Doctrine/DBAL/Portability/Statement.php +++ b/lib/Doctrine/DBAL/Portability/Statement.php @@ -177,7 +177,7 @@ public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = n if ($fetchMode === PDO::FETCH_COLUMN) { foreach ($rows as $num => $row) { - $rows[$num] = array($row); + $rows[$num] = [$row]; } } diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php index 1b1bc316572..46533fdacd2 100644 --- a/lib/Doctrine/DBAL/Query/QueryBuilder.php +++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php @@ -420,7 +420,7 @@ public function add($sqlPartName, $sqlPart, $append = false) $isMultiple = is_array($this->sqlParts[$sqlPartName]); if ($isMultiple && !$isArray) { - $sqlPart = array($sqlPart); + $sqlPart = [$sqlPart]; } $this->state = self::STATE_DIRTY; @@ -1093,7 +1093,7 @@ public function resetQueryParts($queryPartNames = null) public function resetQueryPart($queryPartName) { $this->sqlParts[$queryPartName] = is_array($this->sqlParts[$queryPartName]) - ? array() : null; + ? [] : null; $this->state = self::STATE_DIRTY; @@ -1131,8 +1131,8 @@ private function getSQLForSelect() */ private function getFromClauses() { - $fromClauses = array(); - $knownAliases = array(); + $fromClauses = []; + $knownAliases = []; // Loop through all FROM clauses foreach ($this->sqlParts['from'] as $from) { diff --git a/lib/Doctrine/DBAL/SQLParserUtils.php b/lib/Doctrine/DBAL/SQLParserUtils.php index 4242989cbf8..cf0d7829600 100644 --- a/lib/Doctrine/DBAL/SQLParserUtils.php +++ b/lib/Doctrine/DBAL/SQLParserUtils.php @@ -52,11 +52,11 @@ static public function getPlaceholderPositions($statement, $isPositional = true) { $match = ($isPositional) ? '?' : ':'; if (strpos($statement, $match) === false) { - return array(); + return []; } $token = ($isPositional) ? self::POSITIONAL_TOKEN : self::NAMED_TOKEN; - $paramMap = array(); + $paramMap = []; foreach (self::getUnquotedStatementFragments($statement) as $fragment) { preg_match_all("/$token/", $fragment[0], $matches, PREG_OFFSET_CAPTURE); @@ -87,7 +87,7 @@ static public function getPlaceholderPositions($statement, $isPositional = true) static public function expandListParameters($query, $params, $types) { $isPositional = is_int(key($params)); - $arrayPositions = array(); + $arrayPositions = []; $bindIndex = -1; if ($isPositional) { @@ -110,7 +110,7 @@ static public function expandListParameters($query, $params, $types) } if (( ! $arrayPositions && $isPositional)) { - return array($query, $params, $types); + return [$query, $params, $types]; } $paramPos = self::getPlaceholderPositions($query, $isPositional); @@ -140,7 +140,7 @@ static public function expandListParameters($query, $params, $types) array_slice($types, 0, $needle), $count ? array_fill(0, $count, $types[$needle] - Connection::ARRAY_PARAM_OFFSET) : // array needles are at PDO::PARAM_* + 100 - array(), + [], array_slice($types, $needle + 1) ); @@ -151,12 +151,12 @@ static public function expandListParameters($query, $params, $types) $queryOffset += (strlen($expandStr) - 1); } - return array($query, $params, $types); + return [$query, $params, $types]; } $queryOffset = 0; - $typesOrd = array(); - $paramsOrd = array(); + $typesOrd = []; + $paramsOrd = []; foreach ($paramPos as $pos => $paramName) { $paramLen = strlen($paramName) + 1; @@ -185,7 +185,7 @@ static public function expandListParameters($query, $params, $types) $query = substr($query, 0, $pos) . $expandStr . substr($query, ($pos + $paramLen)); } - return array($query, $paramsOrd, $typesOrd); + return [$query, $paramsOrd, $typesOrd]; } /** diff --git a/lib/Doctrine/DBAL/Schema/AbstractAsset.php b/lib/Doctrine/DBAL/Schema/AbstractAsset.php index 051dce92c4f..d82f8b679ca 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractAsset.php +++ b/lib/Doctrine/DBAL/Schema/AbstractAsset.php @@ -167,7 +167,7 @@ protected function isIdentifierQuoted($identifier) */ protected function trimQuotes($identifier) { - return str_replace(array('`', '"', '[', ']'), '', $identifier); + return str_replace(['`', '"', '[', ']'], '', $identifier); } /** diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index df3f1df67ba..7adea5f325e 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -94,7 +94,7 @@ public function tryMethod() $args = array_values($args); try { - return call_user_func_array(array($this, $method), $args); + return call_user_func_array([$this, $method], $args); } catch (\Exception $e) { return false; } @@ -263,7 +263,7 @@ public function listTables() { $tableNames = $this->listTableNames(); - $tables = array(); + $tables = []; foreach ($tableNames as $tableName) { $tables[] = $this->listTableDetails($tableName); } @@ -279,13 +279,13 @@ public function listTables() public function listTableDetails($tableName) { $columns = $this->listTableColumns($tableName); - $foreignKeys = array(); + $foreignKeys = []; if ($this->_platform->supportsForeignKeyConstraints()) { $foreignKeys = $this->listTableForeignKeys($tableName); } $indexes = $this->listTableIndexes($tableName); - return new Table($tableName, $columns, $indexes, $foreignKeys, false, array()); + return new Table($tableName, $columns, $indexes, $foreignKeys, false, []); } /** @@ -655,7 +655,7 @@ public function renameTable($name, $newName) */ protected function _getPortableDatabasesList($databases) { - $list = array(); + $list = []; foreach ($databases as $value) { if ($value = $this->_getPortableDatabaseDefinition($value)) { $list[] = $value; @@ -674,7 +674,7 @@ protected function _getPortableDatabasesList($databases) */ protected function getPortableNamespacesList(array $namespaces) { - $namespacesList = array(); + $namespacesList = []; foreach ($namespaces as $namespace) { $namespacesList[] = $this->getPortableNamespaceDefinition($namespace); @@ -712,7 +712,7 @@ protected function getPortableNamespaceDefinition(array $namespace) */ protected function _getPortableFunctionsList($functions) { - $list = array(); + $list = []; foreach ($functions as $value) { if ($value = $this->_getPortableFunctionDefinition($value)) { $list[] = $value; @@ -739,7 +739,7 @@ protected function _getPortableFunctionDefinition($function) */ protected function _getPortableTriggersList($triggers) { - $list = array(); + $list = []; foreach ($triggers as $value) { if ($value = $this->_getPortableTriggerDefinition($value)) { $list[] = $value; @@ -766,7 +766,7 @@ protected function _getPortableTriggerDefinition($trigger) */ protected function _getPortableSequencesList($sequences) { - $list = array(); + $list = []; foreach ($sequences as $value) { if ($value = $this->_getPortableSequenceDefinition($value)) { $list[] = $value; @@ -803,7 +803,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) { $eventManager = $this->_platform->getEventManager(); - $list = array(); + $list = []; foreach ($tableColumns as $tableColumn) { $column = null; $defaultPrevented = false; @@ -848,7 +848,7 @@ abstract protected function _getPortableTableColumnDefinition($tableColumn); */ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null) { - $result = array(); + $result = []; foreach ($tableIndexRows as $tableIndex) { $indexName = $keyName = $tableIndex['key_name']; if ($tableIndex['primary']) { @@ -857,14 +857,14 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null $keyName = strtolower($keyName); if (!isset($result[$keyName])) { - $result[$keyName] = array( + $result[$keyName] = [ 'name' => $indexName, - 'columns' => array($tableIndex['column_name']), + 'columns' => [$tableIndex['column_name']], 'unique' => $tableIndex['non_unique'] ? false : true, 'primary' => $tableIndex['primary'], - 'flags' => isset($tableIndex['flags']) ? $tableIndex['flags'] : array(), - 'options' => isset($tableIndex['where']) ? array('where' => $tableIndex['where']) : array(), - ); + 'flags' => isset($tableIndex['flags']) ? $tableIndex['flags'] : [], + 'options' => isset($tableIndex['where']) ? ['where' => $tableIndex['where']] : [], + ]; } else { $result[$keyName]['columns'][] = $tableIndex['column_name']; } @@ -872,7 +872,7 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null $eventManager = $this->_platform->getEventManager(); - $indexes = array(); + $indexes = []; foreach ($result as $indexKey => $data) { $index = null; $defaultPrevented = false; @@ -904,7 +904,7 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null */ protected function _getPortableTablesList($tables) { - $list = array(); + $list = []; foreach ($tables as $value) { if ($value = $this->_getPortableTableDefinition($value)) { $list[] = $value; @@ -931,7 +931,7 @@ protected function _getPortableTableDefinition($table) */ protected function _getPortableUsersList($users) { - $list = array(); + $list = []; foreach ($users as $value) { if ($value = $this->_getPortableUserDefinition($value)) { $list[] = $value; @@ -958,7 +958,7 @@ protected function _getPortableUserDefinition($user) */ protected function _getPortableViewsList($views) { - $list = array(); + $list = []; foreach ($views as $value) { if ($view = $this->_getPortableViewDefinition($value)) { $viewName = strtolower($view->getQuotedName($this->_platform)); @@ -986,7 +986,7 @@ protected function _getPortableViewDefinition($view) */ protected function _getPortableTableForeignKeysList($tableForeignKeys) { - $list = array(); + $list = []; foreach ($tableForeignKeys as $value) { if ($value = $this->_getPortableTableForeignKeyDefinition($value)) { $list[] = $value; @@ -1025,13 +1025,13 @@ protected function _execSql($sql) */ public function createSchema() { - $namespaces = array(); + $namespaces = []; if ($this->_platform->supportsSchemas()) { $namespaces = $this->listNamespaceNames(); } - $sequences = array(); + $sequences = []; if ($this->_platform->supportsSequences()) { $sequences = $this->listSequences(); @@ -1079,7 +1079,7 @@ public function createSchemaConfig() */ public function getSchemaSearchPaths() { - return array($this->_conn->getDatabase()); + return [$this->_conn->getDatabase()]; } /** diff --git a/lib/Doctrine/DBAL/Schema/Column.php b/lib/Doctrine/DBAL/Schema/Column.php index 192ce1d2eef..082c2f724de 100644 --- a/lib/Doctrine/DBAL/Schema/Column.php +++ b/lib/Doctrine/DBAL/Schema/Column.php @@ -78,7 +78,7 @@ class Column extends AbstractAsset /** * @var array */ - protected $_platformOptions = array(); + protected $_platformOptions = []; /** * @var string|null @@ -93,7 +93,7 @@ class Column extends AbstractAsset /** * @var array */ - protected $_customSchemaOptions = array(); + protected $_customSchemaOptions = []; /** * Creates a new Column. @@ -102,7 +102,7 @@ class Column extends AbstractAsset * @param Type $type * @param array $options */ - public function __construct($columnName, Type $type, array $options=array()) + public function __construct($columnName, Type $type, array $options=[]) { $this->_setName($columnName); $this->setType($type); @@ -469,7 +469,7 @@ public function getCustomSchemaOptions() */ public function toArray() { - return array_merge(array( + return array_merge([ 'name' => $this->_name, 'type' => $this->_type, 'default' => $this->_default, @@ -482,6 +482,6 @@ public function toArray() 'autoincrement' => $this->_autoincrement, 'columnDefinition' => $this->_columnDefinition, 'comment' => $this->_comment, - ), $this->_platformOptions, $this->_customSchemaOptions); + ], $this->_platformOptions, $this->_customSchemaOptions); } } diff --git a/lib/Doctrine/DBAL/Schema/ColumnDiff.php b/lib/Doctrine/DBAL/Schema/ColumnDiff.php index 61d7f731950..96519ff87ac 100644 --- a/lib/Doctrine/DBAL/Schema/ColumnDiff.php +++ b/lib/Doctrine/DBAL/Schema/ColumnDiff.php @@ -41,7 +41,7 @@ class ColumnDiff /** * @var array */ - public $changedProperties = array(); + public $changedProperties = []; /** * @var Column @@ -54,7 +54,7 @@ class ColumnDiff * @param string[] $changedProperties * @param Column $fromColumn */ - public function __construct($oldColumnName, Column $column, array $changedProperties = array(), Column $fromColumn = null) + public function __construct($oldColumnName, Column $column, array $changedProperties = [], Column $fromColumn = null) { $this->oldColumnName = $oldColumnName; $this->column = $column; diff --git a/lib/Doctrine/DBAL/Schema/Comparator.php b/lib/Doctrine/DBAL/Schema/Comparator.php index abedfc06281..e9433b882bc 100644 --- a/lib/Doctrine/DBAL/Schema/Comparator.php +++ b/lib/Doctrine/DBAL/Schema/Comparator.php @@ -60,7 +60,7 @@ public function compare(Schema $fromSchema, Schema $toSchema) $diff = new SchemaDiff(); $diff->fromSchema = $fromSchema; - $foreignKeysToTable = array(); + $foreignKeysToTable = []; foreach ($toSchema->getNamespaces() as $namespace) { if ( ! $fromSchema->hasNamespace($namespace)) { @@ -99,7 +99,7 @@ public function compare(Schema $fromSchema, Schema $toSchema) foreach ($table->getForeignKeys() as $foreignKey) { $foreignTable = strtolower($foreignKey->getForeignTableName()); if (!isset($foreignKeysToTable[$foreignTable])) { - $foreignKeysToTable[$foreignTable] = array(); + $foreignKeysToTable[$foreignTable] = []; } $foreignKeysToTable[$foreignTable][] = $foreignKey; } @@ -315,11 +315,11 @@ public function diffTable(Table $table1, Table $table2) */ private function detectColumnRenamings(TableDiff $tableDifferences) { - $renameCandidates = array(); + $renameCandidates = []; foreach ($tableDifferences->addedColumns as $addedColumnName => $addedColumn) { foreach ($tableDifferences->removedColumns as $removedColumn) { if (count($this->diffColumn($addedColumn, $removedColumn)) == 0) { - $renameCandidates[$addedColumn->getName()][] = array($removedColumn, $addedColumn, $addedColumnName); + $renameCandidates[$addedColumn->getName()][] = [$removedColumn, $addedColumn, $addedColumnName]; } } } @@ -349,13 +349,13 @@ private function detectColumnRenamings(TableDiff $tableDifferences) */ private function detectIndexRenamings(TableDiff $tableDifferences) { - $renameCandidates = array(); + $renameCandidates = []; // Gather possible rename candidates by comparing each added and removed index based on semantics. foreach ($tableDifferences->addedIndexes as $addedIndexName => $addedIndex) { foreach ($tableDifferences->removedIndexes as $removedIndex) { if (! $this->diffIndex($addedIndex, $removedIndex)) { - $renameCandidates[$addedIndex->getName()][] = array($removedIndex, $addedIndex, $addedIndexName); + $renameCandidates[$addedIndex->getName()][] = [$removedIndex, $addedIndex, $addedIndexName]; } } } @@ -427,9 +427,9 @@ public function diffColumn(Column $column1, Column $column2) $properties1 = $column1->toArray(); $properties2 = $column2->toArray(); - $changedProperties = array(); + $changedProperties = []; - foreach (array('type', 'notnull', 'unsigned', 'autoincrement') as $property) { + foreach (['type', 'notnull', 'unsigned', 'autoincrement'] as $property) { if ($properties1[$property] != $properties2[$property]) { $changedProperties[] = $property; } diff --git a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php index dc48e009fbe..890bfa4f3fa 100644 --- a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php @@ -90,7 +90,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) break; } - $options = array( + $options = [ 'length' => $length, 'unsigned' => (bool) $unsigned, 'fixed' => (bool) $fixed, @@ -102,8 +102,8 @@ protected function _getPortableTableColumnDefinition($tableColumn) 'comment' => isset($tableColumn['comment']) && $tableColumn['comment'] !== '' ? $tableColumn['comment'] : null, - 'platformOptions' => array(), - ); + 'platformOptions' => [], + ]; if ($scale !== null && $precision !== null) { $options['scale'] = $scale; @@ -118,7 +118,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) */ protected function _getPortableTablesList($tables) { - $tableNames = array(); + $tableNames = []; foreach ($tables as $tableRow) { $tableRow = array_change_key_case($tableRow, \CASE_LOWER); $tableNames[] = $tableRow['name']; @@ -159,22 +159,22 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) */ protected function _getPortableTableForeignKeysList($tableForeignKeys) { - $foreignKeys = array(); + $foreignKeys = []; foreach ($tableForeignKeys as $tableForeignKey) { $tableForeignKey = array_change_key_case($tableForeignKey, \CASE_LOWER); if (!isset($foreignKeys[$tableForeignKey['index_name']])) { - $foreignKeys[$tableForeignKey['index_name']] = array( - 'local_columns' => array($tableForeignKey['local_column']), + $foreignKeys[$tableForeignKey['index_name']] = [ + 'local_columns' => [$tableForeignKey['local_column']], 'foreign_table' => $tableForeignKey['foreign_table'], - 'foreign_columns' => array($tableForeignKey['foreign_column']), + 'foreign_columns' => [$tableForeignKey['foreign_column']], 'name' => $tableForeignKey['index_name'], - 'options' => array( + 'options' => [ 'onUpdate' => $tableForeignKey['on_update'], 'onDelete' => $tableForeignKey['on_delete'], - ) - ); + ] + ]; } else { $foreignKeys[$tableForeignKey['index_name']]['local_columns'][] = $tableForeignKey['local_column']; $foreignKeys[$tableForeignKey['index_name']]['foreign_columns'][] = $tableForeignKey['foreign_column']; diff --git a/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php b/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php index e9503c359a9..0172ae718f0 100644 --- a/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php @@ -39,7 +39,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $type = $this->extractDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type); $tableColumn['COLUMN_COMMENT'] = $this->removeDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type); - $options = array( + $options = [ 'notnull' => !(bool) $tableColumn['IS_NULLABLE'], 'length' => (int) $tableColumn['CHARACTER_MAXIMUM_LENGTH'], 'default' => isset($tableColumn['COLUMN_DEFAULT']) ? $tableColumn['COLUMN_DEFAULT'] : null, @@ -49,7 +49,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) 'comment' => isset($tableColumn['COLUMN_COMMENT']) && '' !== $tableColumn['COLUMN_COMMENT'] ? $tableColumn['COLUMN_COMMENT'] : null, - ); + ]; $column = new Column($tableColumn['COLUMN_NAME'], Type::getType($type), $options); @@ -81,12 +81,12 @@ protected function _getPortableTableDefinition($table) */ public function _getPortableTableForeignKeyDefinition($tableForeignKey) { - $columns = array(); + $columns = []; foreach (explode(',', $tableForeignKey['CONSTRAINT_COLUMNS']) as $value) { $columns[] = trim($value, ' `'); } - $refColumns = array(); + $refColumns = []; foreach (explode(',', $tableForeignKey['REFERENCED_TABLE_COLUMNS']) as $value) { $refColumns[] = trim($value, ' `'); } @@ -96,10 +96,10 @@ public function _getPortableTableForeignKeyDefinition($tableForeignKey) $tableForeignKey['REFERENCED_TABLE_NAME'], $refColumns, $tableForeignKey['CONSTRAINT_NAME'], - array( + [ 'onUpdate' => $tableForeignKey['UPDATE_RULE'], 'onDelete' => $tableForeignKey['DELETE_RULE'], - ) + ] ); } @@ -108,7 +108,7 @@ public function _getPortableTableForeignKeyDefinition($tableForeignKey) */ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { - $indexes = array(); + $indexes = []; foreach ($tableIndexes as $k) { $k['primary'] = (boolean) $k['primary']; $indexes[] = $k; diff --git a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php index 6070eb2e5ba..de6ff9c0b73 100644 --- a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php +++ b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php @@ -75,7 +75,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint * @param string|null $name Name of the foreign key constraint. * @param array $options Options associated with the foreign key constraint. */ - public function __construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name = null, array $options = array()) + public function __construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name = null, array $options = []) { $this->_setName($name); $identifierConstructorCallback = function ($column) { @@ -83,7 +83,7 @@ public function __construct(array $localColumnNames, $foreignTableName, array $f }; $this->_localColumnNames = $localColumnNames ? array_combine($localColumnNames, array_map($identifierConstructorCallback, $localColumnNames)) - : array(); + : []; if ($foreignTableName instanceof Table) { $this->_foreignTableName = $foreignTableName; @@ -93,7 +93,7 @@ public function __construct(array $localColumnNames, $foreignTableName, array $f $this->_foreignColumnNames = $foreignColumnNames ? array_combine($foreignColumnNames, array_map($identifierConstructorCallback, $foreignColumnNames)) - : array(); + : []; $this->_options = $options; } @@ -154,7 +154,7 @@ public function getLocalColumns() */ public function getQuotedLocalColumns(AbstractPlatform $platform) { - $columns = array(); + $columns = []; foreach ($this->_localColumnNames as $column) { $columns[] = $column->getQuotedName($platform); @@ -170,7 +170,7 @@ public function getQuotedLocalColumns(AbstractPlatform $platform) */ public function getUnquotedLocalColumns() { - return array_map(array($this, 'trimQuotes'), $this->getLocalColumns()); + return array_map([$this, 'trimQuotes'], $this->getLocalColumns()); } /** @@ -180,7 +180,7 @@ public function getUnquotedLocalColumns() */ public function getUnquotedForeignColumns() { - return array_map(array($this, 'trimQuotes'), $this->getForeignColumns()); + return array_map([$this, 'trimQuotes'], $this->getForeignColumns()); } /** @@ -277,7 +277,7 @@ public function getForeignColumns() */ public function getQuotedForeignColumns(AbstractPlatform $platform) { - $columns = array(); + $columns = []; foreach ($this->_foreignColumnNames as $column) { $columns[] = $column->getQuotedName($platform); @@ -356,7 +356,7 @@ private function onEvent($event) if (isset($this->_options[$event])) { $onEvent = strtoupper($this->_options[$event]); - if ( ! in_array($onEvent, array('NO ACTION', 'RESTRICT'))) { + if ( ! in_array($onEvent, ['NO ACTION', 'RESTRICT'])) { return $onEvent; } } diff --git a/lib/Doctrine/DBAL/Schema/Index.php b/lib/Doctrine/DBAL/Schema/Index.php index 554d80f78b2..7cfb03ebda3 100644 --- a/lib/Doctrine/DBAL/Schema/Index.php +++ b/lib/Doctrine/DBAL/Schema/Index.php @@ -29,7 +29,7 @@ class Index extends AbstractAsset implements Constraint * * @var Identifier[] */ - protected $_columns = array(); + protected $_columns = []; /** * @var boolean @@ -47,7 +47,7 @@ class Index extends AbstractAsset implements Constraint * * @var array */ - protected $_flags = array(); + protected $_flags = []; /** * Platform specific options @@ -56,7 +56,7 @@ class Index extends AbstractAsset implements Constraint * * @var array */ - private $options = array(); + private $options = []; /** * @param string $indexName @@ -66,7 +66,7 @@ class Index extends AbstractAsset implements Constraint * @param string[] $flags * @param array $options */ - public function __construct($indexName, array $columns, $isUnique = false, $isPrimary = false, array $flags = array(), array $options = array()) + public function __construct($indexName, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = []) { $isUnique = $isUnique || $isPrimary; @@ -112,7 +112,7 @@ public function getColumns() */ public function getQuotedColumns(AbstractPlatform $platform) { - $columns = array(); + $columns = []; foreach ($this->_columns as $column) { $columns[] = $column->getQuotedName($platform); @@ -126,7 +126,7 @@ public function getQuotedColumns(AbstractPlatform $platform) */ public function getUnquotedColumns() { - return array_map(array($this, 'trimQuotes'), $this->getColumns()); + return array_map([$this, 'trimQuotes'], $this->getColumns()); } /** diff --git a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php index 0b36762b6ce..9de4b8e330f 100644 --- a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php @@ -54,10 +54,10 @@ protected function _getPortableTableDefinition($table) */ protected function _getPortableUserDefinition($user) { - return array( + return [ 'user' => $user['User'], 'password' => $user['Password'], - ); + ]; } /** @@ -73,9 +73,9 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) $v['primary'] = false; } if (strpos($v['index_type'], 'FULLTEXT') !== false) { - $v['flags'] = array('FULLTEXT'); + $v['flags'] = ['FULLTEXT']; } elseif (strpos($v['index_type'], 'SPATIAL') !== false) { - $v['flags'] = array('SPATIAL'); + $v['flags'] = ['SPATIAL']; } $tableIndexes[$k] = $v; } @@ -178,7 +178,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $length = ((int) $length == 0) ? null : (int) $length; - $options = array( + $options = [ 'length' => $length, 'unsigned' => (bool) (strpos($tableColumn['type'], 'unsigned') !== false), 'fixed' => (bool) $fixed, @@ -190,7 +190,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) 'comment' => isset($tableColumn['comment']) && $tableColumn['comment'] !== '' ? $tableColumn['comment'] : null, - ); + ]; if ($scale !== null && $precision !== null) { $options['scale'] = $scale; @@ -211,7 +211,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) */ protected function _getPortableTableForeignKeysList($tableForeignKeys) { - $list = array(); + $list = []; foreach ($tableForeignKeys as $value) { $value = array_change_key_case($value, CASE_LOWER); if (!isset($list[$value['constraint_name']])) { @@ -222,28 +222,28 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) $value['update_rule'] = null; } - $list[$value['constraint_name']] = array( + $list[$value['constraint_name']] = [ 'name' => $value['constraint_name'], - 'local' => array(), - 'foreign' => array(), + 'local' => [], + 'foreign' => [], 'foreignTable' => $value['referenced_table_name'], 'onDelete' => $value['delete_rule'], 'onUpdate' => $value['update_rule'], - ); + ]; } $list[$value['constraint_name']]['local'][] = $value['column_name']; $list[$value['constraint_name']]['foreign'][] = $value['referenced_column_name']; } - $result = array(); + $result = []; foreach ($list as $constraint) { $result[] = new ForeignKeyConstraint( array_values($constraint['local']), $constraint['foreignTable'], array_values($constraint['foreign']), $constraint['name'], - array( + [ 'onDelete' => $constraint['onDelete'], 'onUpdate' => $constraint['onUpdate'], - ) + ] ); } diff --git a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php index 9feecdc761b..41be38dcd1e 100644 --- a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php @@ -78,9 +78,9 @@ protected function _getPortableUserDefinition($user) { $user = \array_change_key_case($user, CASE_LOWER); - return array( + return [ 'user' => $user['username'], - ); + ]; } /** @@ -101,7 +101,7 @@ protected function _getPortableTableDefinition($table) */ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) { - $indexBuffer = array(); + $indexBuffer = []; foreach ($tableIndexes as $tableIndex) { $tableIndex = \array_change_key_case($tableIndex, CASE_LOWER); @@ -227,7 +227,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $length = null; } - $options = array( + $options = [ 'notnull' => (bool) ($tableColumn['nullable'] === 'N'), 'fixed' => (bool) $fixed, 'unsigned' => (bool) $unsigned, @@ -238,8 +238,8 @@ protected function _getPortableTableColumnDefinition($tableColumn) 'comment' => isset($tableColumn['comments']) && '' !== $tableColumn['comments'] ? $tableColumn['comments'] : null, - 'platformDetails' => array(), - ); + 'platformDetails' => [], + ]; return new Column($this->getQuotedIdentifierName($tableColumn['column_name']), Type::getType($type), $options); } @@ -249,7 +249,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) */ protected function _getPortableTableForeignKeysList($tableForeignKeys) { - $list = array(); + $list = []; foreach ($tableForeignKeys as $value) { $value = \array_change_key_case($value, CASE_LOWER); if (!isset($list[$value['constraint_name']])) { @@ -257,13 +257,13 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) $value['delete_rule'] = null; } - $list[$value['constraint_name']] = array( + $list[$value['constraint_name']] = [ 'name' => $this->getQuotedIdentifierName($value['constraint_name']), - 'local' => array(), - 'foreign' => array(), + 'local' => [], + 'foreign' => [], 'foreignTable' => $value['references_table'], 'onDelete' => $value['delete_rule'], - ); + ]; } $localColumn = $this->getQuotedIdentifierName($value['local_column']); @@ -273,12 +273,12 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) $list[$value['constraint_name']]['foreign'][$value['position']] = $foreignColumn; } - $result = array(); + $result = []; foreach ($list as $constraint) { $result[] = new ForeignKeyConstraint( array_values($constraint['local']), $this->getQuotedIdentifierName($constraint['foreignTable']), array_values($constraint['foreign']), $this->getQuotedIdentifierName($constraint['name']), - array('onDelete' => $constraint['onDelete']) + ['onDelete' => $constraint['onDelete']] ); } @@ -408,7 +408,7 @@ private function killUserSessions($user) AND p.addr(+) = s.paddr SQL; - $activeUserSessions = $this->_conn->fetchAll($sql, array(strtoupper($user))); + $activeUserSessions = $this->_conn->fetchAll($sql, [strtoupper($user)]); foreach ($activeUserSessions as $activeUserSession) { $activeUserSession = array_change_key_case($activeUserSession, \CASE_LOWER); diff --git a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php index 395ad95af1b..93233f7afd8 100644 --- a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php @@ -118,10 +118,10 @@ public function dropDatabase($database) } $this->_execSql( - array( + [ $this->_platform->getDisallowDatabaseConnectionsSQL($database), $this->_platform->getCloseActiveDatabaseConnectionsSQL($database), - ) + ] ); parent::dropDatabase($database); @@ -153,7 +153,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) return new ForeignKeyConstraint( $localColumns, $foreignTable, $foreignColumns, $tableForeignKey['conname'], - array('onUpdate' => $onUpdate, 'onDelete' => $onDelete) + ['onUpdate' => $onUpdate, 'onDelete' => $onDelete] ); } @@ -178,10 +178,10 @@ protected function _getPortableViewDefinition($view) */ protected function _getPortableUserDefinition($user) { - return array( + return [ 'user' => $user['usename'], 'password' => $user['passwd'] - ); + ]; } /** @@ -207,7 +207,7 @@ protected function _getPortableTableDefinition($table) */ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) { - $buffer = array(); + $buffer = []; foreach ($tableIndexes as $row) { $colNumbers = explode(' ', $row['indkey']); $colNumbersSql = 'IN (' . join(' ,', $colNumbers) . ' )'; @@ -221,13 +221,13 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) foreach ($colNumbers as $colNum) { foreach ($indexColumns as $colRow) { if ($colNum == $colRow['attnum']) { - $buffer[] = array( + $buffer[] = [ 'key_name' => $row['relname'], 'column_name' => trim($colRow['attname']), 'non_unique' => !$row['indisunique'], 'primary' => $row['indisprimary'], 'where' => $row['where'], - ); + ]; } } } @@ -249,7 +249,7 @@ protected function _getPortableDatabaseDefinition($database) */ protected function _getPortableSequencesList($sequences) { - $sequenceDefinitions = array(); + $sequenceDefinitions = []; foreach ($sequences as $sequence) { if ($sequence['schemaname'] != 'public') { @@ -261,7 +261,7 @@ protected function _getPortableSequencesList($sequences) $sequenceDefinitions[$sequenceName] = $sequence; } - $list = array(); + $list = []; foreach ($this->filterAssetNames(array_keys($sequenceDefinitions)) as $sequenceName) { $list[] = $this->_getPortableSequenceDefinition($sequenceDefinitions[$sequenceName]); @@ -307,7 +307,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $tableColumn['length'] = $length; } - $matches = array(); + $matches = []; $autoincrement = false; if (preg_match("/^nextval\('(.*)'(::.*)?\)$/", $tableColumn['default'], $matches)) { @@ -423,7 +423,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $tableColumn['default'] = $match[1]; } - $options = array( + $options = [ 'length' => $length, 'notnull' => (bool) $tableColumn['isnotnull'], 'default' => $tableColumn['default'], @@ -436,7 +436,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) 'comment' => isset($tableColumn['comment']) && $tableColumn['comment'] !== '' ? $tableColumn['comment'] : null, - ); + ]; $column = new Column($tableColumn['field'], Type::getType($type), $options); diff --git a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php index 793a5fe8bad..83f3720a07d 100644 --- a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php @@ -111,7 +111,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) if (null !== $tableColumn['default']) { // Strip quotes from default value. - $default = preg_replace(array("/^'(.*)'$/", "/''/"), array("$1", "'"), $tableColumn['default']); + $default = preg_replace(["/^'(.*)'$/", "/''/"], ["$1", "'"], $tableColumn['default']); if ('autoincrement' == $default) { $default = null; @@ -135,7 +135,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) return new Column( $tableColumn['column_name'], Type::getType($type), - array( + [ 'length' => $type == 'string' ? $tableColumn['length'] : null, 'precision' => $precision, 'scale' => $scale, @@ -147,7 +147,8 @@ protected function _getPortableTableColumnDefinition($tableColumn) 'comment' => isset($tableColumn['comment']) && '' !== $tableColumn['comment'] ? $tableColumn['comment'] : null, - )); + ] + ); } /** @@ -177,16 +178,16 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) */ protected function _getPortableTableForeignKeysList($tableForeignKeys) { - $foreignKeys = array(); + $foreignKeys = []; foreach ($tableForeignKeys as $tableForeignKey) { if (!isset($foreignKeys[$tableForeignKey['index_name']])) { - $foreignKeys[$tableForeignKey['index_name']] = array( - 'local_columns' => array($tableForeignKey['local_column']), + $foreignKeys[$tableForeignKey['index_name']] = [ + 'local_columns' => [$tableForeignKey['local_column']], 'foreign_table' => $tableForeignKey['foreign_table'], - 'foreign_columns' => array($tableForeignKey['foreign_column']), + 'foreign_columns' => [$tableForeignKey['foreign_column']], 'name' => $tableForeignKey['index_name'], - 'options' => array( + 'options' => [ 'notnull' => $tableForeignKey['notnull'], 'match' => $tableForeignKey['match'], 'onUpdate' => $tableForeignKey['on_update'], @@ -194,8 +195,8 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) 'check_on_commit' => $tableForeignKey['check_on_commit'], 'clustered' => $tableForeignKey['clustered'], 'for_olap_workload' => $tableForeignKey['for_olap_workload'] - ) - ); + ] + ]; } else { $foreignKeys[$tableForeignKey['index_name']]['local_columns'][] = $tableForeignKey['local_column']; $foreignKeys[$tableForeignKey['index_name']]['foreign_columns'][] = $tableForeignKey['foreign_column']; @@ -212,7 +213,7 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName = nu { foreach ($tableIndexRows as &$tableIndex) { $tableIndex['primary'] = (boolean) $tableIndex['primary']; - $tableIndex['flags'] = array(); + $tableIndex['flags'] = []; if ($tableIndex['clustered']) { $tableIndex['flags'][] = 'clustered'; diff --git a/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php b/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php index 100a64c22b7..343500677b0 100644 --- a/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php @@ -116,8 +116,8 @@ protected function _getPortableTableColumnDefinition($tableColumn) $type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type); $tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type); - $options = array( - 'length' => ($length == 0 || !in_array($type, array('text', 'string'))) ? null : $length, + $options = [ + 'length' => ($length == 0 || !in_array($type, ['text', 'string'])) ? null : $length, 'unsigned' => false, 'fixed' => (bool) $fixed, 'default' => $default !== 'NULL' ? $default : null, @@ -126,7 +126,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) 'precision' => $tableColumn['precision'], 'autoincrement' => (bool) $tableColumn['autoincrement'], 'comment' => $tableColumn['comment'] !== '' ? $tableColumn['comment'] : null, - ); + ]; $column = new Column($tableColumn['name'], Type::getType($type), $options); @@ -142,20 +142,20 @@ protected function _getPortableTableColumnDefinition($tableColumn) */ protected function _getPortableTableForeignKeysList($tableForeignKeys) { - $foreignKeys = array(); + $foreignKeys = []; foreach ($tableForeignKeys as $tableForeignKey) { if ( ! isset($foreignKeys[$tableForeignKey['ForeignKey']])) { - $foreignKeys[$tableForeignKey['ForeignKey']] = array( - 'local_columns' => array($tableForeignKey['ColumnName']), + $foreignKeys[$tableForeignKey['ForeignKey']] = [ + 'local_columns' => [$tableForeignKey['ColumnName']], 'foreign_table' => $tableForeignKey['ReferenceTableName'], - 'foreign_columns' => array($tableForeignKey['ReferenceColumnName']), + 'foreign_columns' => [$tableForeignKey['ReferenceColumnName']], 'name' => $tableForeignKey['ForeignKey'], - 'options' => array( + 'options' => [ 'onUpdate' => str_replace('_', ' ', $tableForeignKey['update_referential_action_desc']), 'onDelete' => str_replace('_', ' ', $tableForeignKey['delete_referential_action_desc']) - ) - ); + ] + ]; } else { $foreignKeys[$tableForeignKey['ForeignKey']]['local_columns'][] = $tableForeignKey['ColumnName']; $foreignKeys[$tableForeignKey['ForeignKey']]['foreign_columns'][] = $tableForeignKey['ReferenceColumnName']; @@ -173,7 +173,7 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null foreach ($tableIndexRows as &$tableIndex) { $tableIndex['non_unique'] = (boolean) $tableIndex['non_unique']; $tableIndex['primary'] = (boolean) $tableIndex['primary']; - $tableIndex['flags'] = $tableIndex['flags'] ? array($tableIndex['flags']) : null; + $tableIndex['flags'] = $tableIndex['flags'] ? [$tableIndex['flags']] : null; } return parent::_getPortableTableIndexesList($tableIndexRows, $tableName); @@ -237,13 +237,13 @@ public function listTableIndexes($table) $tableIndexes = $this->_conn->fetchAll($sql); } catch (\PDOException $e) { if ($e->getCode() == "IMSSP") { - return array(); + return []; } else { throw $e; } } catch (DBALException $e) { if (strpos($e->getMessage(), 'SQLSTATE [01000, 15472]') === 0) { - return array(); + return []; } else { throw $e; } diff --git a/lib/Doctrine/DBAL/Schema/Schema.php b/lib/Doctrine/DBAL/Schema/Schema.php index 3277ad72cf1..ea63416a723 100644 --- a/lib/Doctrine/DBAL/Schema/Schema.php +++ b/lib/Doctrine/DBAL/Schema/Schema.php @@ -60,17 +60,17 @@ class Schema extends AbstractAsset * * @var array */ - private $namespaces = array(); + private $namespaces = []; /** * @var \Doctrine\DBAL\Schema\Table[] */ - protected $_tables = array(); + protected $_tables = []; /** * @var \Doctrine\DBAL\Schema\Sequence[] */ - protected $_sequences = array(); + protected $_sequences = []; /** * @var \Doctrine\DBAL\Schema\SchemaConfig @@ -84,10 +84,10 @@ class Schema extends AbstractAsset * @param array $namespaces */ public function __construct( - array $tables = array(), - array $sequences = array(), + array $tables = [], + array $sequences = [], SchemaConfig $schemaConfig = null, - array $namespaces = array() + array $namespaces = [] ) { if ($schemaConfig == null) { $schemaConfig = new SchemaConfig(); diff --git a/lib/Doctrine/DBAL/Schema/SchemaConfig.php b/lib/Doctrine/DBAL/Schema/SchemaConfig.php index cc23237d87b..5ed031cbe30 100644 --- a/lib/Doctrine/DBAL/Schema/SchemaConfig.php +++ b/lib/Doctrine/DBAL/Schema/SchemaConfig.php @@ -46,7 +46,7 @@ class SchemaConfig /** * @var array */ - protected $defaultTableOptions = array(); + protected $defaultTableOptions = []; /** * @return boolean diff --git a/lib/Doctrine/DBAL/Schema/SchemaDiff.php b/lib/Doctrine/DBAL/Schema/SchemaDiff.php index 23eccdad8ca..4b828646114 100644 --- a/lib/Doctrine/DBAL/Schema/SchemaDiff.php +++ b/lib/Doctrine/DBAL/Schema/SchemaDiff.php @@ -42,55 +42,55 @@ class SchemaDiff * * @var string[] */ - public $newNamespaces = array(); + public $newNamespaces = []; /** * All removed namespaces. * * @var string[] */ - public $removedNamespaces = array(); + public $removedNamespaces = []; /** * All added tables. * * @var \Doctrine\DBAL\Schema\Table[] */ - public $newTables = array(); + public $newTables = []; /** * All changed tables. * * @var \Doctrine\DBAL\Schema\TableDiff[] */ - public $changedTables = array(); + public $changedTables = []; /** * All removed tables. * * @var \Doctrine\DBAL\Schema\Table[] */ - public $removedTables = array(); + public $removedTables = []; /** * @var \Doctrine\DBAL\Schema\Sequence[] */ - public $newSequences = array(); + public $newSequences = []; /** * @var \Doctrine\DBAL\Schema\Sequence[] */ - public $changedSequences = array(); + public $changedSequences = []; /** * @var \Doctrine\DBAL\Schema\Sequence[] */ - public $removedSequences = array(); + public $removedSequences = []; /** * @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[] */ - public $orphanedForeignKeys = array(); + public $orphanedForeignKeys = []; /** * Constructs an SchemaDiff object. @@ -100,7 +100,7 @@ class SchemaDiff * @param \Doctrine\DBAL\Schema\Table[] $removedTables * @param \Doctrine\DBAL\Schema\Schema|null $fromSchema */ - public function __construct($newTables = array(), $changedTables = array(), $removedTables = array(), Schema $fromSchema = null) + public function __construct($newTables = [], $changedTables = [], $removedTables = [], Schema $fromSchema = null) { $this->newTables = $newTables; $this->changedTables = $changedTables; @@ -144,7 +144,7 @@ public function toSql(AbstractPlatform $platform) */ protected function _toSql(AbstractPlatform $platform, $saveMode = false) { - $sql = array(); + $sql = []; if ($platform->supportsSchemas()) { foreach ($this->newNamespaces as $newNamespace) { @@ -174,7 +174,7 @@ protected function _toSql(AbstractPlatform $platform, $saveMode = false) } } - $foreignKeySql = array(); + $foreignKeySql = []; foreach ($this->newTables as $table) { $sql = array_merge( $sql, diff --git a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php index b3f0ef2bd91..de5afe467e4 100644 --- a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php @@ -52,10 +52,10 @@ public function createDatabase($database) { $params = $this->_conn->getParams(); $driver = $params['driver']; - $options = array( + $options = [ 'driver' => $driver, 'path' => $database - ); + ]; $conn = \Doctrine\DBAL\DriverManager::getConnection($options); $conn->connect(); $conn->close(); @@ -135,7 +135,7 @@ public function listTableForeignKeys($table, $database = null) $deferrable = array_reverse($match[2]); $deferred = array_reverse($match[3]); } else { - $names = $deferrable = $deferred = array(); + $names = $deferrable = $deferred = []; } foreach ($tableForeignKeys as $key => $value) { @@ -165,7 +165,7 @@ protected function _getPortableTableDefinition($table) */ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) { - $indexBuffer = array(); + $indexBuffer = []; // fetch primary $stmt = $this->_conn->executeQuery("PRAGMA TABLE_INFO ('$tableName')"); @@ -180,12 +180,12 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) }); foreach ($indexArray as $indexColumnRow) { if ($indexColumnRow['pk'] != "0") { - $indexBuffer[] = array( + $indexBuffer[] = [ 'key_name' => 'primary', 'primary' => true, 'non_unique' => false, 'column_name' => $indexColumnRow['name'] - ); + ]; } } @@ -194,7 +194,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) // Ignore indexes with reserved names, e.g. autoindexes if (strpos($tableIndex['name'], 'sqlite_') !== 0) { $keyName = $tableIndex['name']; - $idx = array(); + $idx = []; $idx['key_name'] = $keyName; $idx['primary'] = false; $idx['non_unique'] = $tableIndex['unique']?false:true; @@ -217,10 +217,10 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) */ protected function _getPortableTableIndexDefinition($tableIndex) { - return array( + return [ 'name' => $tableIndex['name'], 'unique' => (bool) $tableIndex['unique'] - ); + ]; } /** @@ -339,7 +339,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) break; } - $options = array( + $options = [ 'length' => $length, 'unsigned' => (bool) $unsigned, 'fixed' => $fixed, @@ -348,7 +348,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) 'precision' => $precision, 'scale' => $scale, 'autoincrement' => false, - ); + ]; return new Column($tableColumn['name'], \Doctrine\DBAL\Types\Type::getType($type), $options); } @@ -366,7 +366,7 @@ protected function _getPortableViewDefinition($view) */ protected function _getPortableTableForeignKeysList($tableForeignKeys) { - $list = array(); + $list = []; foreach ($tableForeignKeys as $value) { $value = array_change_key_case($value, CASE_LOWER); $name = $value['constraint_name']; @@ -378,32 +378,32 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) $value['on_update'] = null; } - $list[$name] = array( + $list[$name] = [ 'name' => $name, - 'local' => array(), - 'foreign' => array(), + 'local' => [], + 'foreign' => [], 'foreignTable' => $value['table'], 'onDelete' => $value['on_delete'], 'onUpdate' => $value['on_update'], 'deferrable' => $value['deferrable'], 'deferred'=> $value['deferred'], - ); + ]; } $list[$name]['local'][] = $value['from']; $list[$name]['foreign'][] = $value['to']; } - $result = array(); + $result = []; foreach ($list as $constraint) { $result[] = new ForeignKeyConstraint( array_values($constraint['local']), $constraint['foreignTable'], array_values($constraint['foreign']), $constraint['name'], - array( + [ 'onDelete' => $constraint['onDelete'], 'onUpdate' => $constraint['onUpdate'], 'deferrable' => $constraint['deferrable'], 'deferred'=> $constraint['deferred'], - ) + ] ); } diff --git a/lib/Doctrine/DBAL/Schema/Table.php b/lib/Doctrine/DBAL/Schema/Table.php index 428761ea36a..e81f1b614f5 100644 --- a/lib/Doctrine/DBAL/Schema/Table.php +++ b/lib/Doctrine/DBAL/Schema/Table.php @@ -40,17 +40,17 @@ class Table extends AbstractAsset /** * @var Column[] */ - protected $_columns = array(); + protected $_columns = []; /** * @var Index[] */ - private $implicitIndexes = array(); + private $implicitIndexes = []; /** * @var Index[] */ - protected $_indexes = array(); + protected $_indexes = []; /** * @var string @@ -60,12 +60,12 @@ class Table extends AbstractAsset /** * @var ForeignKeyConstraint[] */ - protected $_fkConstraints = array(); + protected $_fkConstraints = []; /** * @var array */ - protected $_options = array(); + protected $_options = []; /** * @var SchemaConfig @@ -82,7 +82,7 @@ class Table extends AbstractAsset * * @throws DBALException */ - public function __construct($tableName, array $columns=array(), array $indexes=array(), array $fkConstraints=array(), $idGeneratorType = 0, array $options=array()) + public function __construct($tableName, array $columns=[], array $indexes=[], array $fkConstraints=[], $idGeneratorType = 0, array $options=[]) { if (strlen($tableName) == 0) { throw DBALException::invalidTableName($tableName); @@ -155,11 +155,11 @@ public function setPrimaryKey(array $columns, $indexName = false) * * @return self */ - public function addIndex(array $columnNames, $indexName = null, array $flags = array(), array $options = array()) + public function addIndex(array $columnNames, $indexName = null, array $flags = [], array $options = []) { if ($indexName == null) { $indexName = $this->_generateIdentifierName( - array_merge(array($this->getName()), $columnNames), "idx", $this->_getMaxIdentifierLength() + array_merge([$this->getName()], $columnNames), "idx", $this->_getMaxIdentifierLength() ); } @@ -202,15 +202,15 @@ public function dropIndex($indexName) * * @return self */ - public function addUniqueIndex(array $columnNames, $indexName = null, array $options = array()) + public function addUniqueIndex(array $columnNames, $indexName = null, array $options = []) { if ($indexName === null) { $indexName = $this->_generateIdentifierName( - array_merge(array($this->getName()), $columnNames), "uniq", $this->_getMaxIdentifierLength() + array_merge([$this->getName()], $columnNames), "uniq", $this->_getMaxIdentifierLength() ); } - return $this->_addIndex($this->_createIndex($columnNames, $indexName, true, false, array(), $options)); + return $this->_addIndex($this->_createIndex($columnNames, $indexName, true, false, [], $options)); } /** @@ -290,7 +290,7 @@ public function columnsAreIndexed(array $columnsNames) * * @throws SchemaException */ - private function _createIndex(array $columnNames, $indexName, $isUnique, $isPrimary, array $flags = array(), array $options = array()) + private function _createIndex(array $columnNames, $indexName, $isUnique, $isPrimary, array $flags = [], array $options = []) { if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName))) { throw SchemaException::indexNameInvalid($indexName); @@ -316,7 +316,7 @@ private function _createIndex(array $columnNames, $indexName, $isUnique, $isPrim * * @return Column */ - public function addColumn($columnName, $typeName, array $options=array()) + public function addColumn($columnName, $typeName, array $options=[]) { $column = new Column($columnName, Type::getType($typeName), $options); @@ -386,7 +386,7 @@ public function dropColumn($columnName) * * @return self */ - public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=array(), $constraintName = null) + public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=[], $constraintName = null) { $constraintName = $constraintName ?: $this->_generateIdentifierName(array_merge((array) $this->getName(), $localColumnNames), "fk", $this->_getMaxIdentifierLength()); @@ -407,7 +407,7 @@ public function addForeignKeyConstraint($foreignTable, array $localColumnNames, * * @return self */ - public function addUnnamedForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=array()) + public function addUnnamedForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=[]) { return $this->addForeignKeyConstraint($foreignTable, $localColumnNames, $foreignColumnNames, $options); } @@ -427,7 +427,7 @@ public function addUnnamedForeignKeyConstraint($foreignTable, array $localColumn * * @throws SchemaException */ - public function addNamedForeignKeyConstraint($name, $foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=array()) + public function addNamedForeignKeyConstraint($name, $foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=[]) { if ($foreignTable instanceof Table) { foreach ($foreignColumnNames as $columnName) { @@ -496,7 +496,7 @@ protected function _addIndex(Index $indexCandidate) { $indexName = $indexCandidate->getName(); $indexName = $this->normalizeIdentifier($indexName); - $replacedImplicitIndexes = array(); + $replacedImplicitIndexes = []; foreach ($this->implicitIndexes as $name => $implicitIndex) { if ($implicitIndex->isFullfilledBy($indexCandidate) && isset($this->_indexes[$name])) { @@ -547,7 +547,7 @@ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) // In the case of __construct calling this method during hydration from schema-details all the explicitly added indexes // lead to duplicates. This creates computation overhead in this case, however no duplicate indexes are ever added (based on columns). $indexName = $this->_generateIdentifierName( - array_merge(array($this->getName()), $constraint->getColumns()), + array_merge([$this->getName()], $constraint->getColumns()), "idx", $this->_getMaxIdentifierLength() ); diff --git a/lib/Doctrine/DBAL/Schema/TableDiff.php b/lib/Doctrine/DBAL/Schema/TableDiff.php index a837fab6746..50d2a6c3077 100644 --- a/lib/Doctrine/DBAL/Schema/TableDiff.php +++ b/lib/Doctrine/DBAL/Schema/TableDiff.php @@ -52,70 +52,70 @@ class TableDiff * * @var \Doctrine\DBAL\Schema\ColumnDiff[] */ - public $changedColumns = array(); + public $changedColumns = []; /** * All removed fields. * * @var \Doctrine\DBAL\Schema\Column[] */ - public $removedColumns = array(); + public $removedColumns = []; /** * Columns that are only renamed from key to column instance name. * * @var \Doctrine\DBAL\Schema\Column[] */ - public $renamedColumns = array(); + public $renamedColumns = []; /** * All added indexes. * * @var \Doctrine\DBAL\Schema\Index[] */ - public $addedIndexes = array(); + public $addedIndexes = []; /** * All changed indexes. * * @var \Doctrine\DBAL\Schema\Index[] */ - public $changedIndexes = array(); + public $changedIndexes = []; /** * All removed indexes * * @var \Doctrine\DBAL\Schema\Index[] */ - public $removedIndexes = array(); + public $removedIndexes = []; /** * Indexes that are only renamed but are identical otherwise. * * @var \Doctrine\DBAL\Schema\Index[] */ - public $renamedIndexes = array(); + public $renamedIndexes = []; /** * All added foreign key definitions * * @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[] */ - public $addedForeignKeys = array(); + public $addedForeignKeys = []; /** * All changed foreign keys * * @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[] */ - public $changedForeignKeys = array(); + public $changedForeignKeys = []; /** * All removed foreign keys * * @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[] */ - public $removedForeignKeys = array(); + public $removedForeignKeys = []; /** * @var \Doctrine\DBAL\Schema\Table @@ -134,9 +134,9 @@ class TableDiff * @param \Doctrine\DBAL\Schema\Index[] $removedIndexes * @param \Doctrine\DBAL\Schema\Table|null $fromTable */ - public function __construct($tableName, $addedColumns = array(), - $changedColumns = array(), $removedColumns = array(), $addedIndexes = array(), - $changedIndexes = array(), $removedIndexes = array(), Table $fromTable = null) + public function __construct($tableName, $addedColumns = [], + $changedColumns = [], $removedColumns = [], $addedIndexes = [], + $changedIndexes = [], $removedIndexes = [], Table $fromTable = null) { $this->name = $tableName; $this->addedColumns = $addedColumns; diff --git a/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php b/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php index ba196d0b4d6..777a1540d12 100644 --- a/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php +++ b/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php @@ -29,22 +29,22 @@ class CreateSchemaSqlCollector extends AbstractVisitor /** * @var array */ - private $createNamespaceQueries = array(); + private $createNamespaceQueries = []; /** * @var array */ - private $createTableQueries = array(); + private $createTableQueries = []; /** * @var array */ - private $createSequenceQueries = array(); + private $createSequenceQueries = []; /** * @var array */ - private $createFkConstraintQueries = array(); + private $createFkConstraintQueries = []; /** * @@ -101,10 +101,10 @@ public function acceptSequence(Sequence $sequence) */ public function resetQueries() { - $this->createNamespaceQueries = array(); - $this->createTableQueries = array(); - $this->createSequenceQueries = array(); - $this->createFkConstraintQueries = array(); + $this->createNamespaceQueries = []; + $this->createTableQueries = []; + $this->createSequenceQueries = []; + $this->createFkConstraintQueries = []; } /** diff --git a/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php b/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php index ab9752d5842..58c324c6c3f 100644 --- a/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php +++ b/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php @@ -106,7 +106,7 @@ public function clearQueries() */ public function getQueries() { - $sql = array(); + $sql = []; foreach ($this->constraints as $fkConstraint) { $localTable = $this->constraints[$fkConstraint]; diff --git a/lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php b/lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php index 1573ddf5b22..33f1888a3d6 100644 --- a/lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php +++ b/lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php @@ -41,11 +41,11 @@ public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkCons $this->output .= $this->createNodeRelation( $fkConstraint->getLocalTableName() . ":col" . current($fkConstraint->getLocalColumns()).":se", $fkConstraint->getForeignTableName() . ":col" . current($fkConstraint->getForeignColumns()).":se", - array( + [ 'dir' => 'back', 'arrowtail' => 'dot', 'arrowhead' => 'normal', - ) + ] ); } @@ -69,10 +69,10 @@ public function acceptTable(Table $table) { $this->output .= $this->createNode( $table->getName(), - array( + [ 'label' => $this->createTableLabel($table), 'shape' => 'plaintext', - ) + ] ); } diff --git a/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php b/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php index b7830fa3c2a..562c2d091ef 100644 --- a/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php +++ b/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php @@ -183,10 +183,10 @@ public function dropAllSchema() */ private function partitionSchema(Schema $schema) { - return array( + return [ $this->extractSchemaFederation($schema, false), $this->extractSchemaFederation($schema, true), - ); + ]; } /** diff --git a/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php b/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php index 7e45cb756d0..514bf73145a 100644 --- a/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php +++ b/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php @@ -53,7 +53,7 @@ class MultiTenantVisitor implements Visitor /** * @var array */ - private $excludedTables = array(); + private $excludedTables = []; /** * @var string diff --git a/lib/Doctrine/DBAL/Statement.php b/lib/Doctrine/DBAL/Statement.php index 88038dc6184..82764ca19bc 100644 --- a/lib/Doctrine/DBAL/Statement.php +++ b/lib/Doctrine/DBAL/Statement.php @@ -44,14 +44,14 @@ class Statement implements \IteratorAggregate, DriverStatement * * @var array */ - protected $params = array(); + protected $params = []; /** * The parameter types. * * @var array */ - protected $types = array(); + protected $types = []; /** * The underlying driver statement. @@ -181,8 +181,8 @@ public function execute($params = null) if ($logger) { $logger->stopQuery(); } - $this->params = array(); - $this->types = array(); + $this->params = []; + $this->types = []; return $stmt; } diff --git a/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php b/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php index 4d76ca92b7a..d183421d514 100644 --- a/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php +++ b/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php @@ -45,11 +45,11 @@ protected function configure() $this ->setName('dbal:import') ->setDescription('Import SQL file(s) directly to Database.') - ->setDefinition(array( + ->setDefinition([ new InputArgument( 'file', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'File path(s) of SQL to be executed.' ) - )) + ]) ->setHelp(<< 'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords', 'mysql57' => 'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords', 'sqlserver' => 'Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords', @@ -47,7 +47,7 @@ class ReservedWordsCommand extends Command 'sqlanywhere11' => 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords', 'sqlanywhere12' => 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords', 'sqlanywhere16' => 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords', - ); + ]; /** * If you want to add or replace a keywords list use this command. @@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $keywordLists = (array) $input->getOption('list'); if ( ! $keywordLists) { - $keywordLists = array( + $keywordLists = [ 'mysql', 'mysql57', 'pgsql', @@ -135,7 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output) 'sqlanywhere11', 'sqlanywhere12', 'sqlanywhere16', - ); + ]; } $keywords = []; diff --git a/lib/Doctrine/DBAL/Types/JsonArrayType.php b/lib/Doctrine/DBAL/Types/JsonArrayType.php index 60b72137ece..6231239269c 100644 --- a/lib/Doctrine/DBAL/Types/JsonArrayType.php +++ b/lib/Doctrine/DBAL/Types/JsonArrayType.php @@ -36,7 +36,7 @@ class JsonArrayType extends JsonType public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null || $value === '') { - return array(); + return []; } $value = (is_resource($value)) ? stream_get_contents($value) : $value; diff --git a/lib/Doctrine/DBAL/Types/SimpleArrayType.php b/lib/Doctrine/DBAL/Types/SimpleArrayType.php index 47c821be4e4..9ee3ac806fd 100644 --- a/lib/Doctrine/DBAL/Types/SimpleArrayType.php +++ b/lib/Doctrine/DBAL/Types/SimpleArrayType.php @@ -57,7 +57,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null) { - return array(); + return []; } $value = (is_resource($value)) ? stream_get_contents($value) : $value; diff --git a/lib/Doctrine/DBAL/Types/Type.php b/lib/Doctrine/DBAL/Types/Type.php index 1379bb203ed..114dea6ba41 100644 --- a/lib/Doctrine/DBAL/Types/Type.php +++ b/lib/Doctrine/DBAL/Types/Type.php @@ -64,14 +64,14 @@ abstract class Type * * @var array */ - private static $_typeObjects = array(); + private static $_typeObjects = []; /** * The map of supported doctrine mapping types. * * @var array */ - private static $_typesMap = array( + private static $_typesMap = [ self::TARRAY => ArrayType::class, self::SIMPLE_ARRAY => SimpleArrayType::class, self::JSON_ARRAY => JsonArrayType::class, @@ -97,7 +97,7 @@ abstract class Type self::BLOB => BlobType::class, self::GUID => GuidType::class, self::DATEINTERVAL => DateIntervalType::class, - ); + ]; /** * Prevents instantiation and forces use of the factory method. @@ -333,7 +333,7 @@ public function convertToPHPValueSQL($sqlExpr, $platform) */ public function getMappedDatabaseTypes(AbstractPlatform $platform) { - return array(); + return []; } /**