Skip to content

Commit

Permalink
Merge pull request #2776 from AlessandroMinoccheri/fix_array_in_shard…
Browse files Browse the repository at this point in the history
…ing_dir

Use short array declarations
  • Loading branch information
Ocramius committed Jul 12, 2017
2 parents a55b83e + 8e72d1e commit 5c5966a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php
Expand Up @@ -236,7 +236,7 @@ protected function connectTo($shardId)
{
$params = $this->getParams();

$driverOptions = isset($params['driverOptions']) ? $params['driverOptions'] : array();
$driverOptions = isset($params['driverOptions']) ? $params['driverOptions'] : [];

$connectionParams = $this->connections[$shardId];

Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Sharding/PoolingShardManager.php
Expand Up @@ -88,10 +88,10 @@ public function getCurrentDistributionValue()
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;
Expand All @@ -113,7 +113,7 @@ public function queryAll($sql, array $params, array $types)
throw new \RuntimeException("No shards found.");
}

$result = array();
$result = [];
$oldDistribution = $this->getCurrentDistributionValue();

foreach ($shards as $shard) {
Expand Down
Expand Up @@ -69,7 +69,7 @@ public function __construct(Connection $conn, SQLAzureShardManager $shardManager
*/
public function getCreateSchema(Schema $createSchema)
{
$sql = array();
$sql = [];

list($global, $federation) = $this->partitionSchema($createSchema);

Expand Down Expand Up @@ -234,7 +234,7 @@ private function extractSchemaFederation(Schema $schema, $isFederation)
private function work(Schema $schema, \Closure $operation)
{
list($global, $federation) = $this->partitionSchema($schema);
$sql = array();
$sql = [];

$this->shardManager->selectGlobal();
$globalSql = $operation($this->synchronizer, $global);
Expand Down Expand Up @@ -290,7 +290,7 @@ private function getFederationTypeDefaultValue()
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)";
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php
Expand Up @@ -198,14 +198,14 @@ public function getShards()
/**
* {@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) {
Expand Down
Expand Up @@ -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;
Expand All @@ -94,9 +94,9 @@ public function acceptTable(Table $table)
return;
}

$table->addColumn($this->tenantColumnName, $this->tenantColumnType, array(
$table->addColumn($this->tenantColumnName, $this->tenantColumnType, [
'default' => "federation_filtering_value('". $this->distributionName ."')",
));
]);

$clusteredIndex = $this->getClusteredIndex($table);

Expand Down

0 comments on commit 5c5966a

Please sign in to comment.