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 ...@@ -236,7 +236,7 @@ class PoolingShardConnection extends Connection
{ {
$params = $this->getParams(); $params = $this->getParams();
$driverOptions = isset($params['driverOptions']) ? $params['driverOptions'] : array(); $driverOptions = isset($params['driverOptions']) ? $params['driverOptions'] : [];
$connectionParams = $this->connections[$shardId]; $connectionParams = $this->connections[$shardId];
......
...@@ -88,10 +88,10 @@ class PoolingShardManager implements ShardManager ...@@ -88,10 +88,10 @@ class PoolingShardManager implements ShardManager
public function getShards() public function getShards()
{ {
$params = $this->conn->getParams(); $params = $this->conn->getParams();
$shards = array(); $shards = [];
foreach ($params['shards'] as $shard) { foreach ($params['shards'] as $shard) {
$shards[] = array('id' => $shard['id']); $shards[] = ['id' => $shard['id']];
} }
return $shards; return $shards;
...@@ -113,7 +113,7 @@ class PoolingShardManager implements ShardManager ...@@ -113,7 +113,7 @@ class PoolingShardManager implements ShardManager
throw new \RuntimeException("No shards found."); throw new \RuntimeException("No shards found.");
} }
$result = array(); $result = [];
$oldDistribution = $this->getCurrentDistributionValue(); $oldDistribution = $this->getCurrentDistributionValue();
foreach ($shards as $shard) { foreach ($shards as $shard) {
......
...@@ -69,7 +69,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer ...@@ -69,7 +69,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
*/ */
public function getCreateSchema(Schema $createSchema) public function getCreateSchema(Schema $createSchema)
{ {
$sql = array(); $sql = [];
list($global, $federation) = $this->partitionSchema($createSchema); list($global, $federation) = $this->partitionSchema($createSchema);
...@@ -234,7 +234,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer ...@@ -234,7 +234,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
private function work(Schema $schema, \Closure $operation) private function work(Schema $schema, \Closure $operation)
{ {
list($global, $federation) = $this->partitionSchema($schema); list($global, $federation) = $this->partitionSchema($schema);
$sql = array(); $sql = [];
$this->shardManager->selectGlobal(); $this->shardManager->selectGlobal();
$globalSql = $operation($this->synchronizer, $global); $globalSql = $operation($this->synchronizer, $global);
...@@ -290,7 +290,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer ...@@ -290,7 +290,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
private function getCreateFederationStatement() private function getCreateFederationStatement()
{ {
$federationType = Type::getType($this->shardManager->getDistributionType()); $federationType = Type::getType($this->shardManager->getDistributionType());
$federationTypeSql = $federationType->getSQLDeclaration(array(), $this->conn->getDatabasePlatform()); $federationTypeSql = $federationType->getSQLDeclaration([], $this->conn->getDatabasePlatform());
return "--Create Federation\n" . return "--Create Federation\n" .
"CREATE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " " . $federationTypeSql ." RANGE)"; "CREATE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " " . $federationTypeSql ." RANGE)";
......
...@@ -198,14 +198,14 @@ class SQLAzureShardManager implements ShardManager ...@@ -198,14 +198,14 @@ class SQLAzureShardManager implements ShardManager
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function queryAll($sql, array $params = array(), array $types = array()) public function queryAll($sql, array $params = [], array $types = [])
{ {
$shards = $this->getShards(); $shards = $this->getShards();
if (!$shards) { if (!$shards) {
throw new \RuntimeException("No shards found for " . $this->federationName); throw new \RuntimeException("No shards found for " . $this->federationName);
} }
$result = array(); $result = [];
$oldDistribution = $this->getCurrentDistributionValue(); $oldDistribution = $this->getCurrentDistributionValue();
foreach ($shards as $shard) { foreach ($shards as $shard) {
......
...@@ -78,7 +78,7 @@ class MultiTenantVisitor implements Visitor ...@@ -78,7 +78,7 @@ class MultiTenantVisitor implements Visitor
* @param string $tenantColumnName * @param string $tenantColumnName
* @param string|null $distributionName * @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->excludedTables = $excludedTables;
$this->tenantColumnName = $tenantColumnName; $this->tenantColumnName = $tenantColumnName;
...@@ -94,9 +94,9 @@ class MultiTenantVisitor implements Visitor ...@@ -94,9 +94,9 @@ class MultiTenantVisitor implements Visitor
return; return;
} }
$table->addColumn($this->tenantColumnName, $this->tenantColumnType, array( $table->addColumn($this->tenantColumnName, $this->tenantColumnType, [
'default' => "federation_filtering_value('". $this->distributionName ."')", 'default' => "federation_filtering_value('". $this->distributionName ."')",
)); ]);
$clusteredIndex = $this->getClusteredIndex($table); $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