summaryrefslogtreecommitdiffstats
path: root/lib/private/DB
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 09:30:18 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 16:34:56 +0100
commitb80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch)
treeec20e0ffa2f86b9b54939a83a785407319f94559 /lib/private/DB
parent62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff)
downloadnextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.tar.gz
nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.zip
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/DB')
-rw-r--r--lib/private/DB/Connection.php8
-rw-r--r--lib/private/DB/ConnectionFactory.php4
-rw-r--r--lib/private/DB/MDB2SchemaReader.php6
-rw-r--r--lib/private/DB/Migrator.php6
-rw-r--r--lib/private/DB/OracleConnection.php10
-rw-r--r--lib/private/DB/PgSqlTools.php4
-rw-r--r--lib/private/DB/QueryBuilder/CompositeExpression.php2
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php2
-rw-r--r--lib/private/DB/SQLiteMigrator.php4
-rw-r--r--lib/private/DB/SQLiteSessionInit.php2
10 files changed, 24 insertions, 24 deletions
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index 8150f08593f..03cd7f1af66 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -190,7 +190,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
*
* @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)
{
$query = $this->replaceTablePrefix($query);
$query = $this->adapter->fixupStatement($query);
@@ -211,7 +211,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
*
* @throws \Doctrine\DBAL\DBALException
*/
- public function executeUpdate($query, array $params = array(), array $types = array())
+ public function executeUpdate($query, array $params = [], array $types = [])
{
$query = $this->replaceTablePrefix($query);
$query = $this->adapter->fixupStatement($query);
@@ -373,7 +373,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
public function dropTable($table) {
$table = $this->tablePrefix . trim($table);
$schema = $this->getSchemaManager();
- if($schema->tablesExist(array($table))) {
+ if($schema->tablesExist([$table])) {
$schema->dropTable($table);
}
}
@@ -387,7 +387,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
public function tableExists($table){
$table = $this->tablePrefix . trim($table);
$schema = $this->getSchemaManager();
- return $schema->tablesExist(array($table));
+ return $schema->tablesExist([$table]);
}
// internal use
diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php
index 427a292b6b5..3722aa9a05e 100644
--- a/lib/private/DB/ConnectionFactory.php
+++ b/lib/private/DB/ConnectionFactory.php
@@ -106,9 +106,9 @@ class ConnectionFactory {
// \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL
// driver is missing. In this case, we won't be able to connect anyway.
if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) {
- $result['driverOptions'] = array(
+ $result['driverOptions'] = [
\PDO::MYSQL_ATTR_FOUND_ROWS => true,
- );
+ ];
}
return $result;
}
diff --git a/lib/private/DB/MDB2SchemaReader.php b/lib/private/DB/MDB2SchemaReader.php
index b18929cbd19..874537298ee 100644
--- a/lib/private/DB/MDB2SchemaReader.php
+++ b/lib/private/DB/MDB2SchemaReader.php
@@ -155,7 +155,7 @@ class MDB2SchemaReader {
* @throws \DomainException
*/
private function loadField($table, $xml) {
- $options = array( 'notnull' => false );
+ $options = [ 'notnull' => false ];
foreach ($xml->children() as $child) {
/**
* @var \SimpleXMLElement $child
@@ -262,7 +262,7 @@ class MDB2SchemaReader {
$table->addColumn($name, $type, $options);
if (!empty($options['primary']) && $options['primary']) {
- $table->setPrimaryKey(array($name));
+ $table->setPrimaryKey([$name]);
}
}
}
@@ -274,7 +274,7 @@ class MDB2SchemaReader {
*/
private function loadIndex($table, $xml) {
$name = null;
- $fields = array();
+ $fields = [];
foreach ($xml->children() as $child) {
/**
* @var \SimpleXMLElement $child
diff --git a/lib/private/DB/Migrator.php b/lib/private/DB/Migrator.php
index 8b1621a5f55..bda0720b3bb 100644
--- a/lib/private/DB/Migrator.php
+++ b/lib/private/DB/Migrator.php
@@ -155,7 +155,7 @@ class Migrator {
$tmpTable = $this->renameTableSchema($table, $tmpName);
$schemaConfig = new SchemaConfig();
$schemaConfig->setName($this->connection->getDatabase());
- $schema = new Schema(array($tmpTable), array(), $schemaConfig);
+ $schema = new Schema([$tmpTable], [], $schemaConfig);
try {
$this->applySchema($schema);
@@ -180,7 +180,7 @@ class Migrator {
* @var \Doctrine\DBAL\Schema\Index[] $indexes
*/
$indexes = $table->getIndexes();
- $newIndexes = array();
+ $newIndexes = [];
foreach ($indexes as $index) {
if ($index->isPrimary()) {
// do not rename primary key
@@ -193,7 +193,7 @@ class Migrator {
}
// foreign keys are not supported so we just set it to an empty array
- return new Table($newName, $table->getColumns(), $newIndexes, array(), 0, $table->getOptions());
+ return new Table($newName, $table->getColumns(), $newIndexes, [], 0, $table->getOptions());
}
public function createSchema() {
diff --git a/lib/private/DB/OracleConnection.php b/lib/private/DB/OracleConnection.php
index 236d462b02c..4c906a0107d 100644
--- a/lib/private/DB/OracleConnection.php
+++ b/lib/private/DB/OracleConnection.php
@@ -46,7 +46,7 @@ class OracleConnection extends Connection {
/**
* {@inheritDoc}
*/
- public function insert($tableName, array $data, array $types = array()) {
+ public function insert($tableName, array $data, array $types = []) {
if ($tableName[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
$tableName = $this->quoteIdentifier($tableName);
}
@@ -57,7 +57,7 @@ class OracleConnection extends Connection {
/**
* {@inheritDoc}
*/
- public function update($tableName, array $data, array $identifier, array $types = array()) {
+ public function update($tableName, array $data, array $identifier, array $types = []) {
if ($tableName[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
$tableName = $this->quoteIdentifier($tableName);
}
@@ -69,7 +69,7 @@ class OracleConnection extends Connection {
/**
* {@inheritDoc}
*/
- public function delete($tableExpression, array $identifier, array $types = array()) {
+ public function delete($tableExpression, array $identifier, array $types = []) {
if ($tableExpression[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
$tableExpression = $this->quoteIdentifier($tableExpression);
}
@@ -86,7 +86,7 @@ class OracleConnection extends Connection {
$table = $this->tablePrefix . trim($table);
$table = $this->quoteIdentifier($table);
$schema = $this->getSchemaManager();
- if($schema->tablesExist(array($table))) {
+ if($schema->tablesExist([$table])) {
$schema->dropTable($table);
}
}
@@ -101,6 +101,6 @@ class OracleConnection extends Connection {
$table = $this->tablePrefix . trim($table);
$table = $this->quoteIdentifier($table);
$schema = $this->getSchemaManager();
- return $schema->tablesExist(array($table));
+ return $schema->tablesExist([$table]);
}
}
diff --git a/lib/private/DB/PgSqlTools.php b/lib/private/DB/PgSqlTools.php
index d98116292a4..72e1dfe1b27 100644
--- a/lib/private/DB/PgSqlTools.php
+++ b/lib/private/DB/PgSqlTools.php
@@ -57,10 +57,10 @@ class PgSqlTools {
$sqlInfo = 'SELECT table_schema, table_name, column_name
FROM information_schema.columns
WHERE column_default = ? AND table_catalog = ?';
- $sequenceInfo = $conn->fetchAssoc($sqlInfo, array(
+ $sequenceInfo = $conn->fetchAssoc($sqlInfo, [
"nextval('$sequenceName'::regclass)",
$databaseName
- ));
+ ]);
$tableName = $sequenceInfo['table_name'];
$columnName = $sequenceInfo['column_name'];
$sqlMaxId = "SELECT MAX($columnName) FROM $tableName";
diff --git a/lib/private/DB/QueryBuilder/CompositeExpression.php b/lib/private/DB/QueryBuilder/CompositeExpression.php
index ba5ee173352..1e96910af4a 100644
--- a/lib/private/DB/QueryBuilder/CompositeExpression.php
+++ b/lib/private/DB/QueryBuilder/CompositeExpression.php
@@ -44,7 +44,7 @@ class CompositeExpression implements ICompositeExpression, \Countable {
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
*/
- public function addMultiple(array $parts = array()) {
+ public function addMultiple(array $parts = []) {
$this->compositeExpression->addMultiple($parts);
return $this;
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index c9fc3eb5f21..9871e9284f8 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -273,7 +273,7 @@ class QueryBuilder implements IQueryBuilder {
*
* @return $this This QueryBuilder instance.
*/
- public function setParameters(array $params, array $types = array()) {
+ public function setParameters(array $params, array $types = []) {
$this->queryBuilder->setParameters($params, $types);
return $this;
diff --git a/lib/private/DB/SQLiteMigrator.php b/lib/private/DB/SQLiteMigrator.php
index bd9504a3fed..244bbd6f628 100644
--- a/lib/private/DB/SQLiteMigrator.php
+++ b/lib/private/DB/SQLiteMigrator.php
@@ -43,10 +43,10 @@ class SQLiteMigrator extends Migrator {
$tmpFile = $this->buildTempDatabase();
copy($dbFile, $tmpFile);
- $connectionParams = array(
+ $connectionParams = [
'path' => $tmpFile,
'driver' => 'pdo_sqlite',
- );
+ ];
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams);
try {
$this->applySchema($targetSchema, $conn);
diff --git a/lib/private/DB/SQLiteSessionInit.php b/lib/private/DB/SQLiteSessionInit.php
index a34bd509091..ed4d75cb278 100644
--- a/lib/private/DB/SQLiteSessionInit.php
+++ b/lib/private/DB/SQLiteSessionInit.php
@@ -65,6 +65,6 @@ class SQLiteSessionInit implements EventSubscriber {
}
public function getSubscribedEvents() {
- return array(Events::postConnect);
+ return [Events::postConnect];
}
}