Commit 5c5966aa authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2776 from AlessandroMinoccheri/fix_array_in_sharding_dir

Use short array declarations
parents a55b83ea 8e72d1ee
......@@ -236,7 +236,7 @@ class PoolingShardConnection extends Connection
{
$params = $this->getParams();
$driverOptions = isset($params['driverOptions']) ? $params['driverOptions'] : array();
$driverOptions = isset($params['driverOptions']) ? $params['driverOptions'] : [];
$connectionParams = $this->connections[$shardId];
......
......@@ -88,10 +88,10 @@ class PoolingShardManager implements ShardManager
public function getShards()
{
$params = $this->conn->getParams();
$shards = array();
$shards = [];
foreach ($params['shards'] as $shard) {
$shards[] = array('id' => $shard['id']);
$shards[] = ['id' => $shard['id']];
}
return $shards;
......@@ -113,7 +113,7 @@ class PoolingShardManager implements ShardManager
throw new \RuntimeException("No shards found.");
}
$result = array();
$result = [];
$oldDistribution = $this->getCurrentDistributionValue();
foreach ($shards as $shard) {
......
......@@ -69,7 +69,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
*/
public function getCreateSchema(Schema $createSchema)
{
$sql = array();
$sql = [];
list($global, $federation) = $this->partitionSchema($createSchema);
......@@ -234,7 +234,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
private function work(Schema $schema, \Closure $operation)
{
list($global, $federation) = $this->partitionSchema($schema);
$sql = array();
$sql = [];
$this->shardManager->selectGlobal();
$globalSql = $operation($this->synchronizer, $global);
......@@ -290,7 +290,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
private function getCreateFederationStatement()
{
$federationType = Type::getType($this->shardManager->getDistributionType());
$federationTypeSql = $federationType->getSQLDeclaration(array(), $this->conn->getDatabasePlatform());
$federationTypeSql = $federationType->getSQLDeclaration([], $this->conn->getDatabasePlatform());
return "--Create Federation\n" .
"CREATE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " " . $federationTypeSql ." RANGE)";
......
......@@ -198,14 +198,14 @@ class SQLAzureShardManager implements ShardManager
/**
* {@inheritDoc}
*/
public function queryAll($sql, array $params = array(), array $types = array())
public function queryAll($sql, array $params = [], array $types = [])
{
$shards = $this->getShards();
if (!$shards) {
throw new \RuntimeException("No shards found for " . $this->federationName);
}
$result = array();
$result = [];
$oldDistribution = $this->getCurrentDistributionValue();
foreach ($shards as $shard) {
......
......@@ -78,7 +78,7 @@ class MultiTenantVisitor implements Visitor
* @param string $tenantColumnName
* @param string|null $distributionName
*/
public function __construct(array $excludedTables = array(), $tenantColumnName = 'tenant_id', $distributionName = null)
public function __construct(array $excludedTables = [], $tenantColumnName = 'tenant_id', $distributionName = null)
{
$this->excludedTables = $excludedTables;
$this->tenantColumnName = $tenantColumnName;
......@@ -94,9 +94,9 @@ class MultiTenantVisitor implements Visitor
return;
}
$table->addColumn($this->tenantColumnName, $this->tenantColumnType, array(
$table->addColumn($this->tenantColumnName, $this->tenantColumnType, [
'default' => "federation_filtering_value('". $this->distributionName ."')",
));
]);
$clusteredIndex = $this->getClusteredIndex($table);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment