Commit 55382d04 authored by Dries's avatar Dries

- Patch #318016 by Dave Reid: step one to standardizing type-hinting.

parent 372846e1
......@@ -459,7 +459,7 @@ public function makeSequenceName($table, $field) {
* not be set by a user. If there is an error, this method will return NULL
* and may throw an exception if $options['throw_exception'] is TRUE.
*/
public function query($query, Array $args = array(), $options = array()) {
public function query($query, array $args = array(), $options = array()) {
// Use default values if not already set.
$options += $this->defaultOptions();
......@@ -522,7 +522,7 @@ public function query($query, Array $args = array(), $options = array()) {
* @return
* A new SelectQuery object.
*/
public function select($table, $alias = NULL, Array $options = array()) {
public function select($table, $alias = NULL, array $options = array()) {
if (empty($this->selectClass)) {
$this->selectClass = 'SelectQuery_' . $this->driver();
if (!class_exists($this->selectClass)) {
......@@ -546,7 +546,7 @@ public function select($table, $alias = NULL, Array $options = array()) {
* @return
* A new InsertQuery object.
*/
public function insert($table, Array $options = array()) {
public function insert($table, array $options = array()) {
if (empty($this->insertClass)) {
$this->insertClass = 'InsertQuery_' . $this->driver();
if (!class_exists($this->insertClass)) {
......@@ -566,7 +566,7 @@ public function insert($table, Array $options = array()) {
* @return
* A new MergeQuery object.
*/
public function merge($table, Array $options = array()) {
public function merge($table, array $options = array()) {
if (empty($this->mergeClass)) {
$this->mergeClass = 'MergeQuery_' . $this->driver();
if (!class_exists($this->mergeClass)) {
......@@ -587,7 +587,7 @@ public function merge($table, Array $options = array()) {
* @return
* A new UpdateQuery object.
*/
public function update($table, Array $options = array()) {
public function update($table, array $options = array()) {
if (empty($this->updateClass)) {
$this->updateClass = 'UpdateQuery_' . $this->driver();
if (!class_exists($this->updateClass)) {
......@@ -607,7 +607,7 @@ public function update($table, Array $options = array()) {
* @return
* A new DeleteQuery object.
*/
public function delete($table, Array $options = array()) {
public function delete($table, array $options = array()) {
if (empty($this->deleteClass)) {
$this->deleteClass = 'DeleteQuery_' . $this->driver();
if (!class_exists($this->deleteClass)) {
......@@ -693,7 +693,7 @@ public function startTransaction($required = FALSE) {
* A database query result resource, or NULL if the query was not executed
* correctly.
*/
abstract public function queryRange($query, Array $args, $from, $count, Array $options = array());
abstract public function queryRange($query, array $args, $from, $count, array $options = array());
/**
* Runs a SELECT query and stores its results in a temporary table.
......@@ -721,7 +721,7 @@ public function startTransaction($required = FALSE) {
* A database query result resource, or FALSE if the query was not executed
* correctly.
*/
abstract function queryTemporary($query, Array $args, $tablename, Array $options = array());
abstract function queryTemporary($query, array $args, $tablename, array $options = array());
/**
* Returns the type of database driver.
......@@ -1363,7 +1363,7 @@ public function fetchAssoc();
* @return
* An array of results.
*/
// function fetchAll($mode = NULL, $column_index = NULL, Array $constructor_arguments);
// function fetchAll($mode = NULL, $column_index = NULL, array $constructor_arguments);
/**
* Returns an entire single column of a result set as an indexed array.
......@@ -1625,7 +1625,7 @@ function db_query_temporary($query, $args, $tablename, $options = array()) {
* @return
* A new InsertQuery object for this connection.
*/
function db_insert($table, Array $options = array()) {
function db_insert($table, array $options = array()) {
if (empty($options['target']) || $options['target'] == 'slave') {
$options['target'] = 'default';
}
......@@ -1642,7 +1642,7 @@ function db_insert($table, Array $options = array()) {
* @return
* A new MergeQuery object for this connection.
*/
function db_merge($table, Array $options = array()) {
function db_merge($table, array $options = array()) {
if (empty($options['target']) || $options['target'] == 'slave') {
$options['target'] = 'default';
}
......@@ -1659,7 +1659,7 @@ function db_merge($table, Array $options = array()) {
* @return
* A new UpdateQuery object for this connection.
*/
function db_update($table, Array $options = array()) {
function db_update($table, array $options = array()) {
if (empty($options['target']) || $options['target'] == 'slave') {
$options['target'] = 'default';
}
......@@ -1676,7 +1676,7 @@ function db_update($table, Array $options = array()) {
* @return
* A new DeleteQuery object for this connection.
*/
function db_delete($table, Array $options = array()) {
function db_delete($table, array $options = array()) {
if (empty($options['target']) || $options['target'] == 'slave') {
$options['target'] = 'default';
}
......@@ -1695,7 +1695,7 @@ function db_delete($table, Array $options = array()) {
* @return
* A new SelectQuery object for this connection.
*/
function db_select($table, $alias = NULL, Array $options = array()) {
function db_select($table, $alias = NULL, array $options = array()) {
if (empty($options['target'])) {
$options['target'] = 'default';
}
......
......@@ -13,7 +13,7 @@
class DatabaseConnection_mysql extends DatabaseConnection {
public function __construct(Array $connection_options = array()) {
public function __construct(array $connection_options = array()) {
// This driver defaults to non transaction support.
$this->transactionSupport = !empty($connection_option['transactions']);
......@@ -40,11 +40,11 @@ public function __construct(Array $connection_options = array()) {
$this->exec('SET sql_mode=STRICT_ALL_TABLES');
}
public function queryRange($query, Array $args, $from, $count, Array $options = array()) {
public function queryRange($query, array $args, $from, $count, array $options = array()) {
return $this->query($query . ' LIMIT ' . $from . ', ' . $count, $args, $options);
}
public function queryTemporary($query, Array $args, $tablename, Array $options = array()) {
public function queryTemporary($query, array $args, $tablename, array $options = array()) {
return $this->query(preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' Engine=MEMORY SELECT', $query), $args, $options);
}
......
......@@ -13,7 +13,7 @@
class DatabaseConnection_pgsql extends DatabaseConnection {
public function __construct(Array $connection_options = array()) {
public function __construct(array $connection_options = array()) {
// This driver defaults to transaction support, except if explicitly passed FALSE.
$this->transactionSupport = !isset($connection_options['transactions']) || $connection_options['transactions'] === FALSE;
......@@ -31,7 +31,7 @@ public function __construct(Array $connection_options = array()) {
));
}
public function query($query, Array $args = array(), $options = array()) {
public function query($query, array $args = array(), $options = array()) {
$options += $this->defaultOptions();
......@@ -73,11 +73,11 @@ public function query($query, Array $args = array(), $options = array()) {
}
}
public function queryRange($query, Array $args, $from, $count, Array $options = array()) {
public function queryRange($query, array $args, $from, $count, array $options = array()) {
return $this->query($query . ' LIMIT ' . $count . ' OFFSET ' . $from, $args, $options);
}
public function queryTemporary($query, Array $args, $tablename, Array $options = array()) {
public function queryTemporary($query, array $args, $tablename, array $options = array()) {
return $this->query(preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' AS SELECT', $query), $args, $options);
}
......
......@@ -9,7 +9,7 @@
class InsertQuery_pgsql extends InsertQuery {
public function __construct($connection, $table, Array $options = array()) {
public function __construct($connection, $table, array $options = array()) {
parent::__construct($connection, $table, $options);
$this->queryOptions['return'] = Database::RETURN_NULL;
}
......
......@@ -119,7 +119,7 @@ class DatabaseStatementPrefetch implements Iterator, DatabaseStatementInterface
'column' => 0,
);
public function __construct(DatabaseConnection $connection, $query, Array $driver_options = array()) {
public function __construct(DatabaseConnection $connection, $query, array $driver_options = array()) {
$this->dbh = $connection;
$this->queryString = $query;
$this->driverOptions = $driver_options;
......@@ -215,7 +215,7 @@ protected function throwPDOException() {
*
* @param $query
* The query.
* @param Array $args
* @param array $args
* An array of arguments.
* @return
* A PDOStatement object.
......
......@@ -253,7 +253,7 @@ class InsertQuery extends Query {
*/
protected $insertValues = array();
public function __construct($connection, $table, Array $options = array()) {
public function __construct($connection, $table, array $options = array()) {
$options['return'] = Database::RETURN_INSERT_ID;
$options += array('delay' => FALSE);
parent::__construct($connection, $options);
......@@ -279,7 +279,7 @@ public function __construct($connection, $table, Array $options = array()) {
* @return
* The called object.
*/
public function fields(Array $fields, Array $values = array()) {
public function fields(array $fields, array $values = array()) {
if (empty($this->insertFields)) {
if (empty($values)) {
if (!is_numeric(key($fields))) {
......@@ -309,7 +309,7 @@ public function fields(Array $fields, Array $values = array()) {
* @return
* The called object.
*/
public function values(Array $values) {
public function values(array $values) {
if (is_numeric(key($values))) {
$this->insertValues[] = $values;
}
......@@ -342,7 +342,7 @@ public function values(Array $values) {
* @return
* The called object.
*/
public function useDefaults(Array $fields) {
public function useDefaults(array $fields) {
$this->defaultFields = $fields;
return $this;
}
......@@ -486,7 +486,7 @@ class MergeQuery extends Query {
*/
protected $expressionFields = array();
public function __construct($connection, $table, Array $options = array()) {
public function __construct($connection, $table, array $options = array()) {
$options['return'] = Database::RETURN_AFFECTED;
parent::__construct($connection, $options);
$this->table = $table;
......@@ -510,7 +510,7 @@ public function __construct($connection, $table, Array $options = array()) {
* @return
* The called object.
*/
public function fields(Array $fields, Array $values = array()) {
public function fields(array $fields, array $values = array()) {
if (count($values) > 0) {
$fields = array_combine($fields, $values);
}
......@@ -544,7 +544,7 @@ public function fields(Array $fields, Array $values = array()) {
* @return
* The called object.
*/
public function key(Array $fields, Array $values = array()) {
public function key(array $fields, array $values = array()) {
if ($values) {
$fields = array_combine($fields, $values);
}
......@@ -568,7 +568,7 @@ public function key(Array $fields, Array $values = array()) {
* @return
* The called object.
*/
public function update(Array $fields, Array $values = array()) {
public function update(array $fields, array $values = array()) {
if ($values) {
$fields = array_combine($fields, $values);
}
......@@ -624,7 +624,7 @@ public function updateExcept($exclude_fields) {
* @return
* The called object.
*/
public function expression($field, $expression, Array $arguments = NULL) {
public function expression($field, $expression, array $arguments = NULL) {
$this->expressionFields[$field] = array(
'expression' => $expression,
'arguments' => $arguments,
......@@ -719,7 +719,7 @@ class DeleteQuery extends Query implements QueryConditionInterface {
*/
protected $condition;
public function __construct(DatabaseConnection $connection, $table, Array $options = array()) {
public function __construct(DatabaseConnection $connection, $table, array $options = array()) {
$options['return'] = Database::RETURN_AFFECTED;
parent::__construct($connection, $options);
$this->table = $table;
......@@ -824,7 +824,7 @@ class UpdateQuery extends Query implements QueryConditionInterface {
protected $expressionFields = array();
public function __construct(DatabaseConnection $connection, $table, Array $options = array()) {
public function __construct(DatabaseConnection $connection, $table, array $options = array()) {
$options['return'] = Database::RETURN_AFFECTED;
parent::__construct($connection, $options);
$this->table = $table;
......@@ -866,7 +866,7 @@ public function compile(DatabaseConnection $connection) {
* @return
* The called object.
*/
public function fields(Array $fields) {
public function fields(array $fields) {
$this->fields = $fields;
return $this;
}
......@@ -888,7 +888,7 @@ public function fields(Array $fields) {
* @return
* The called object.
*/
public function expression($field, $expression, Array $arguments = NULL) {
public function expression($field, $expression, array $arguments = NULL) {
$this->expressionFields[$field] = array(
'expression' => $expression,
'arguments' => $arguments,
......
......@@ -384,7 +384,7 @@ public function addField($table_alias, $field, $alias = NULL) {
* @return
* The called object.
*/
public function fields($table_alias, Array $fields = array()) {
public function fields($table_alias, array $fields = array()) {
if ($fields) {
foreach ($fields as $field) {
......
......@@ -18,7 +18,7 @@
*/
class DatabaseConnection_sqlite extends DatabaseConnection {
public function __construct(Array $connection_options = array()) {
public function __construct(array $connection_options = array()) {
// We don't need a specific PDOStatement class here, we simulate it below.
$this->statementClass = NULL;
......@@ -99,7 +99,7 @@ public function sqlFunctionRand($seed = NULL) {
* a DatabaseStatement_sqlite object, that will create a PDOStatement
* using the semi-private PDOPrepare() method below.
*/
public function prepare($query, Array $options = array()) {
public function prepare($query, array $options = array()) {
return new DatabaseStatement_sqlite($this, $query, $options);
}
......@@ -115,15 +115,15 @@ public function prepare($query, Array $options = array()) {
* DatabaseStatement_sqlite needs to call it, we have no other choice but to
* expose this function to the world.
*/
public function PDOPrepare($query, Array $options = array()) {
public function PDOPrepare($query, array $options = array()) {
return parent::prepare($query, $options);
}
public function queryRange($query, Array $args, $from, $count, Array $options = array()) {
public function queryRange($query, array $args, $from, $count, array $options = array()) {
return $this->query($query . ' LIMIT ' . $from . ', ' . $count, $args, $options);
}
public function queryTemporary($query, Array $args, $tablename, Array $options = array()) {
public function queryTemporary($query, array $args, $tablename, array $options = array()) {
return $this->query(preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' AS SELECT', $query), $args, $options);
}
......
......@@ -672,7 +672,7 @@ protected function drupalCreateUser($permissions = NULL) {
* @return
* Role ID of newly created role, or FALSE if role creation failed.
*/
protected function _drupalCreateRole(Array $permissions = NULL) {
protected function _drupalCreateRole(array $permissions = NULL) {
// Generate string version of permissions list.
if ($permissions === NULL) {
$permissions = array('access comments', 'access content', 'post comments', 'post comments without approval');
......@@ -711,7 +711,7 @@ protected function _drupalCreateRole(Array $permissions = NULL) {
* @return
* TRUE or FALSE depending on whether the permissions are valid.
*/
protected function checkPermissions(Array $permissions, $reset = FALSE) {
protected function checkPermissions(array $permissions, $reset = FALSE) {
static $available;
if (!isset($available) || $reset) {
......@@ -1024,7 +1024,7 @@ protected function parse() {
* @return
* The retrieved HTML string, also available as $this->drupalGetContent()
*/
protected function drupalGet($path, Array $options = array(), Array $headers = array()) {
protected function drupalGet($path, array $options = array(), array $headers = array()) {
$options['absolute'] = TRUE;
// We re-using a CURL connection here. If that connection still has certain
......@@ -1075,7 +1075,7 @@ protected function drupalGet($path, Array $options = array(), Array $headers = a
* An array containing additional HTTP request headers, each formatted as
* "name: value".
*/
protected function drupalPost($path, $edit, $submit, Array $options = array(), Array $headers = array()) {
protected function drupalPost($path, $edit, $submit, array $options = array(), array $headers = array()) {
$submit_matches = FALSE;
if (isset($path)) {
$html = $this->drupalGet($path, $options);
......@@ -1170,7 +1170,7 @@ protected function checkForMetaRefresh() {
* @return
* The retrieved headers, also available as $this->drupalGetContent()
*/
protected function drupalHead($path, Array $options = array(), Array $headers = array()) {
protected function drupalHead($path, array $options = array(), array $headers = array()) {
$options['absolute'] = TRUE;
$out = $this->curlExec(array(CURLOPT_NOBODY => TRUE, CURLOPT_URL => url($path, $options), CURLOPT_HTTPHEADER => $headers));
$this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up.
......
......@@ -142,7 +142,7 @@ class CacheSavingCase extends CacheTestCase {
* Test the saving and restoring of an object.
*/
function testObject() {
$test_object = new StdClass();
$test_object = new stdClass();
$test_object->test1 = $this->randomName('100');
$test_object->test2 = 100;
$test_object->test3 = array('drupal1', 'drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6'));
......
......@@ -64,7 +64,7 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase {
// Create files with some php to parse - one 'new', one 'existing' so
// we test all the important code paths in _registry_parse_files.
foreach ($this->fileTypes as $fileType) {
$this->$fileType = new StdClass();
$this->$fileType = new stdClass();
$this->$fileType->fileName = file_directory_path() . '/registry_test_' . md5(rand());
$this->$fileType->functionName = 'registry_test_function' . md5(rand());
$this->$fileType->className = 'registry_test_class' . md5(rand());
......
......@@ -132,7 +132,7 @@ class EnableDisableCoreTestCase extends DrupalWebTestCase {
* @param array $modules Modules to check.
* @param boolean $enabled Module state.
*/
function assertModules(Array $modules, $enabled) {
function assertModules(array $modules, $enabled) {
module_list(TRUE);
foreach ($modules as $module) {
if ($enabled) {
......
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