Skip to content

Commit 94268d5

Browse files
committed
Use square bracket array syntax available since 5.4
1 parent 50152be commit 94268d5

113 files changed

Lines changed: 978 additions & 977 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

vendor/Horde/Db/Adapter/Abstract.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class Horde_Db_Adapter_Abstract
2727
* Config options
2828
* @var array
2929
*/
30-
protected $_config = array();
30+
protected $_config = [];
3131

3232
/**
3333
* @var mixed
@@ -77,7 +77,7 @@ abstract class Horde_Db_Adapter_Abstract
7777
/**
7878
* @var array
7979
*/
80-
protected $_schemaMethods = array();
80+
protected $_schemaMethods = [];
8181

8282

8383
/*##########################################################################
@@ -92,8 +92,8 @@ public function __construct($config)
9292
{
9393
// Create a stub if we don't have a useable cache.
9494
if (isset($config['cache'])
95-
&& is_callable(array($config['cache'], 'get'))
96-
&& is_callable(array($config['cache'], 'set'))) {
95+
&& is_callable([$config['cache'], 'get'])
96+
&& is_callable([$config['cache'], 'set'])) {
9797
$this->_cache = $config['cache'];
9898
unset($config['cache']);
9999
} else {
@@ -102,7 +102,7 @@ public function __construct($config)
102102

103103
// Create a stub if we don't have a useable logger.
104104
if (isset($config['logger'])
105-
&& is_callable(array($config['logger'], 'log'))) {
105+
&& is_callable([$config['logger'], 'log'])) {
106106
$this->_logger = $config['logger'];
107107
unset($config['logger']);
108108
} else {
@@ -116,9 +116,9 @@ public function __construct($config)
116116
// object.
117117
if (!$this->_schemaClass)
118118
$this->_schemaClass = get_class($this).'_Schema';
119-
$this->_schema = new $this->_schemaClass($this, array(
119+
$this->_schema = new $this->_schemaClass($this, [
120120
'cache' => $this->_cache,
121-
'logger' => $this->_logger));
121+
'logger' => $this->_logger]);
122122
$this->_schemaMethods = array_flip(get_class_methods($this->_schema));
123123

124124
$this->connect();
@@ -146,7 +146,7 @@ public function __destruct()
146146
public function __call($method, $args)
147147
{
148148
if (isset($this->_schemaMethods[$method])) {
149-
return call_user_func_array(array($this->_schema, $method), $args);
149+
return call_user_func_array([$this->_schema, $method], $args);
150150
}
151151

152152
throw new BadMethodCallException('Call to undeclared method "'.$method.'"');
@@ -291,7 +291,7 @@ public function select($sql, $arg1=null, $arg2=null)
291291
*/
292292
public function selectAll($sql, $arg1=null, $arg2=null)
293293
{
294-
$rows = array();
294+
$rows = [];
295295
$result = $this->select($sql, $arg1, $arg2);
296296
if ($result) {
297297
foreach ($result as $row) {
@@ -313,7 +313,7 @@ public function selectAll($sql, $arg1=null, $arg2=null)
313313
public function selectOne($sql, $arg1=null, $arg2=null)
314314
{
315315
$result = $this->selectAll($sql, $arg1, $arg2);
316-
return $result ? current($result) : array();
316+
return $result ? current($result) : [];
317317
}
318318

319319
/**
@@ -344,7 +344,7 @@ public function selectValues($sql, $arg1=null, $arg2=null)
344344
foreach ($result as $row) {
345345
$values[] = current($row);
346346
}
347-
return isset($values) ? $values : array();
347+
return isset($values) ? $values : [];
348348
}
349349

350350
/**
@@ -493,7 +493,7 @@ public function sanitizeLimit($limit)
493493
* add_lock! 'SELECT * FROM suppliers', :lock => true
494494
* add_lock! 'SELECT * FROM suppliers', :lock => ' FOR UPDATE'
495495
*/
496-
public function addLock(&$sql, $options = array())
496+
public function addLock(&$sql, $options = [])
497497
{
498498
if (isset($options['lock']) && is_string($options['lock'])) {
499499
$sql .= ' ' . $lock;

vendor/Horde/Db/Adapter/Abstract/ColumnDefinition.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public function toSql()
6767
} catch (Exception $e) {
6868
$sql .= $this->_type;
6969
}
70-
return $this->_addColumnOptions($sql, array('null' => $this->_null,
71-
'default' => $this->_default));
70+
return $this->_addColumnOptions($sql, ['null' => $this->_null,
71+
'default' => $this->_default]);
7272
}
7373

7474
/**
@@ -220,7 +220,7 @@ public function setNull($null)
220220
protected function _addColumnOptions($sql, $options)
221221
{
222222
return $this->_base->addColumnOptions($sql,
223-
array_merge($options, array('column' => $this))
223+
array_merge($options, ['column' => $this])
224224
);
225225
}
226226

vendor/Horde/Db/Adapter/Abstract/Schema.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ abstract class Horde_Db_Adapter_Abstract_Schema
4141
/**
4242
* @var array
4343
*/
44-
protected $_adapterMethods = array();
44+
protected $_adapterMethods = [];
4545

4646

4747
/*##########################################################################
@@ -52,7 +52,7 @@ abstract class Horde_Db_Adapter_Abstract_Schema
5252
* @param Horde_Db_Adapter_Abstract $adapter
5353
* @param array $config
5454
*/
55-
public function __construct($adapter, $config = array())
55+
public function __construct($adapter, $config = [])
5656
{
5757
$this->_adapter = $adapter;
5858
$this->_adapterMethods = array_flip(get_class_methods($adapter));
@@ -75,7 +75,7 @@ public function __construct($adapter, $config = array())
7575
public function __call($method, $args)
7676
{
7777
if (isset($this->_adapterMethods[$method])) {
78-
return call_user_func_array(array($this->_adapter, $method), $args);
78+
return call_user_func_array([$this->_adapter, $method], $args);
7979
}
8080

8181
throw new BadMethodCallException('Call to undeclared method "'.$method.'"');
@@ -96,7 +96,7 @@ public function __call($method, $args)
9696
*/
9797
public function quote($value, $column=null)
9898
{
99-
if (is_object($value) && is_callable(array($value, 'quotedId'))) {
99+
if (is_object($value) && is_callable([$value, 'quotedId'])) {
100100
return $value->quotedId();
101101
}
102102

@@ -144,7 +144,7 @@ public function quote($value, $column=null)
144144
*/
145145
public function quoteString($string)
146146
{
147-
return "'".str_replace(array('\\', '\''), array('\\\\', '\\\''), $string)."'";
147+
return "'".str_replace(['\\', '\''], ['\\\\', '\\\''], $string)."'";
148148
}
149149

150150
/**
@@ -213,7 +213,7 @@ public function quotedStringPrefix()
213213
*/
214214
public function nativeDatabaseTypes()
215215
{
216-
return array();
216+
return [];
217217
}
218218

219219
/**
@@ -328,7 +328,7 @@ abstract public function columns($tableName, $name=null);
328328
* @param string $name
329329
* @param array $options
330330
*/
331-
public function createTable($name, $options=array())
331+
public function createTable($name, $options=[])
332332
{
333333
$pk = isset($options['primaryKey']) &&
334334
$options['primaryKey'] === false ? false : 'id';
@@ -346,7 +346,7 @@ public function createTable($name, $options=array())
346346
* @param string $name
347347
* @param array $options
348348
*/
349-
public function endTable($name, $options=array())
349+
public function endTable($name, $options=[])
350350
{
351351
if ($name instanceof Horde_Db_Adapter_Abstract_TableDefinition) {
352352
$tableDefinition = $name;
@@ -399,7 +399,7 @@ public function dropTable($name)
399399
* @param string $type
400400
* @param array $options
401401
*/
402-
public function addColumn($tableName, $columnName, $type, $options=array())
402+
public function addColumn($tableName, $columnName, $type, $options=[])
403403
{
404404
$this->_clearTableCache($tableName);
405405

@@ -442,7 +442,7 @@ public function removeColumn($tableName, $columnName)
442442
* @param string $type
443443
* @param array $options
444444
*/
445-
abstract public function changeColumn($tableName, $columnName, $type, $options=array());
445+
abstract public function changeColumn($tableName, $columnName, $type, $options=[]);
446446

447447
/**
448448
* Sets a new default value for a column. If you want to set the default
@@ -503,12 +503,12 @@ abstract public function renameColumn($tableName, $columnName, $newColumnName);
503503
* @param string $columnName
504504
* @param array $options
505505
*/
506-
public function addIndex($tableName, $columnName, $options=array())
506+
public function addIndex($tableName, $columnName, $options=[])
507507
{
508508
$this->_clearTableCache($tableName);
509509

510510
$columnNames = (array)($columnName);
511-
$indexName = $this->indexName($tableName, array('column' => $columnNames));
511+
$indexName = $this->indexName($tableName, ['column' => $columnNames]);
512512

513513
$indexType = !empty($options['unique']) ? "UNIQUE" : null;
514514
$indexName = !empty($options['name']) ? $options['name'] : $indexName;
@@ -539,7 +539,7 @@ public function addIndex($tableName, $columnName, $options=array())
539539
* @param string $tableName
540540
* @param array $options
541541
*/
542-
public function removeIndex($tableName, $options=array())
542+
public function removeIndex($tableName, $options=[])
543543
{
544544
$this->_clearTableCache($tableName);
545545

@@ -554,10 +554,10 @@ public function removeIndex($tableName, $options=array())
554554
* @param string $tableName
555555
* @param array $options
556556
*/
557-
public function indexName($tableName, $options=array())
557+
public function indexName($tableName, $options=[])
558558
{
559559
if (!is_array($options)) {
560-
$options = array('column' => $options);
560+
$options = ['column' => $options];
561561
}
562562

563563
if (isset($options['column'])) {

vendor/Horde/Db/Adapter/Abstract/TableDefinition.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class Horde_Db_Adapter_Abstract_TableDefinition implements ArrayAccess
2828
protected $_options = null;
2929
protected $_columns = null;
3030

31-
protected $_columntypes = array ('string', 'text', 'integer', 'float',
32-
'datetime', 'timestamp', 'time', 'date', 'binary', 'boolean');
31+
protected $_columntypes = ['string', 'text', 'integer', 'float',
32+
'datetime', 'timestamp', 'time', 'date', 'binary', 'boolean'];
3333

3434
/**
3535
* Class Constructor
@@ -38,12 +38,12 @@ class Horde_Db_Adapter_Abstract_TableDefinition implements ArrayAccess
3838
* @param Horde_Db_Adapter_Abstract_Schema $base
3939
* @param array $options
4040
*/
41-
public function __construct($name, $base, $options=array())
41+
public function __construct($name, $base, $options=[])
4242
{
4343
$this->_name = $name;
4444
$this->_base = $base;
4545
$this->_options = $options;
46-
$this->_columns = array();
46+
$this->_columns = [];
4747
}
4848

4949
/**
@@ -114,7 +114,7 @@ public function primaryKey($name)
114114
*
115115
* @return TableDefinition
116116
*/
117-
public function column($name, $type, $options=array())
117+
public function column($name, $type, $options=[])
118118
{
119119
if (is_array($name)) {
120120
foreach ($name as $col)
@@ -153,7 +153,7 @@ public function column($name, $type, $options=array())
153153
*/
154154
public function timestamps()
155155
{
156-
return $this->column(array('created_at', 'updated_at'), 'datetime');
156+
return $this->column(['created_at', 'updated_at'], 'datetime');
157157
}
158158

159159
/*
@@ -196,7 +196,7 @@ public function __call($method, $arguments)
196196
}
197197
else if (count($arguments) > 0 && count($arguments) < 3) {
198198
return $this->column($arguments[0], $method,
199-
isset($arguments[1]) ? $arguments[1] : array());
199+
isset($arguments[1]) ? $arguments[1] : []);
200200
}
201201
else {
202202
throw new BadMethodCallException('Method "'.$method.'" takes two arguments');
@@ -220,7 +220,7 @@ public function end()
220220
*/
221221
public function toSql()
222222
{
223-
$cols = array();
223+
$cols = [];
224224
foreach ($this->_columns as $col) { $cols[] = $col->toSql(); }
225225

226226
return " ".implode(", \n ", $cols);

vendor/Horde/Db/Adapter/Mssql/Schema.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ public function loadModel($model)
8484
$identity = '';
8585
}
8686

87-
$model->addField($col['column_name'], array('type' => $type,
87+
$model->addField($col['column_name'], ['type' => $type,
8888
'null' => !(bool)$col['is_nullable'] == 'NO',
89-
'default' => $col['column_def']));
89+
'default' => $col['column_def']]);
9090
if (strtolower($identity) == 'identity') {
9191
$model->key = $col['column_name'];
9292
}

vendor/Horde/Db/Adapter/Mysql/Column.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Horde_Db_Adapter_Mysql_Column extends Horde_Db_Adapter_Abstract_Column
2626
/**
2727
* @var array
2828
*/
29-
protected static $_hasEmptyStringDefault = array('binary', 'string', 'text');
29+
protected static $_hasEmptyStringDefault = ['binary', 'string', 'text'];
3030

3131
/**
3232
* @var string

0 commit comments

Comments
 (0)