Commit 3620310d authored by Dries's avatar Dries

- Patch #818206 by Berdir et al: apply coding standard for no-arg constructors.

parent 7d4a02a3
......@@ -262,7 +262,7 @@ function file_stream_wrapper_get_instance_by_uri($uri) {
$scheme = file_uri_scheme($uri);
$class = file_stream_wrapper_get_class($scheme);
if (class_exists($class)) {
$instance = new $class;
$instance = new $class();
$instance->setUri($uri);
return $instance;
}
......@@ -293,7 +293,7 @@ function file_stream_wrapper_get_instance_by_uri($uri) {
function file_stream_wrapper_get_instance_by_scheme($scheme) {
$class = file_stream_wrapper_get_class($scheme);
if (class_exists($class)) {
$instance = new $class;
$instance = new $class();
$instance->setUri($scheme . '://');
return $instance;
}
......@@ -1662,7 +1662,7 @@ function file_scan_directory($dir, $mask, $options = array(), $depth = 0) {
elseif ($depth >= $options['min_depth'] && preg_match($mask, $filename)) {
// Always use this match over anything already set in $files with the
// same $$options['key'].
$file = new StdClass;
$file = new stdClass();
$file->uri = $uri;
$file->filename = $filename;
$file->name = pathinfo($filename, PATHINFO_FILENAME);
......
......@@ -242,7 +242,7 @@ function drupal_mail_system($module, $key) {
if (empty($instances[$class])) {
$interfaces = class_implements($class);
if (isset($interfaces['MailSystemInterface'])) {
$instances[$class] = new $class;
$instances[$class] = new $class();
}
else {
throw new Exception(t('Class %class does not implement interface %interface', array('%class' => $class, '%interface' => 'MailSystemInterface')));
......
......@@ -631,7 +631,7 @@ function block_load($module, $delta) {
// If the block does not exist in the database yet return a stub block
// object.
if (empty($block)) {
$block = new stdClass;
$block = new stdClass();
$block->module = $module;
$block->delta = $delta;
}
......
......@@ -363,7 +363,7 @@ function dashboard_update() {
foreach ($blocks as $weight => $block_string) {
// Parse the query string to determine the block's module and delta.
preg_match('/block-([^-]+)-(.+)/', $block_string, $matches);
$block = new stdClass;
$block = new stdClass();
$block->module = $matches[1];
$block->delta = $matches[2];
......
......@@ -1805,7 +1805,7 @@ function hook_field_update_forbid($field, $prior_field, $has_data) {
// Identify the keys that will be lost.
$lost_keys = array_diff(array_keys($field['settings']['allowed_values']), array_keys($prior_field['settings']['allowed_values']));
// If any data exist for those keys, forbid the update.
$query = new EntityFieldQuery;
$query = new EntityFieldQuery();
$found = $query
->fieldCondition($prior_field['field_name'], 'value', $lost_keys)
->range(0, 1)
......
......@@ -1039,7 +1039,7 @@ function field_purge_batch($batch_size) {
// field_purge_data() will need the field array.
$field = field_info_field_by_id($instance['field_id']);
// Retrieve some entities.
$query = new EntityFieldQuery;
$query = new EntityFieldQuery();
$results = $query
->fieldCondition($field)
->entityCondition('bundle', $instance['bundle'])
......
......@@ -2826,7 +2826,7 @@ class FieldBulkDeleteTestCase extends FieldTestCase {
$field = reset($this->fields);
// There are 10 entities of this bundle.
$query = new EntityFieldQuery;
$query = new EntityFieldQuery();
$found = $query
->fieldCondition($field)
->entityCondition('bundle', $bundle)
......@@ -2843,7 +2843,7 @@ class FieldBulkDeleteTestCase extends FieldTestCase {
$this->assertEqual($instances[0]['bundle'], $bundle, 'The deleted instance is for the correct bundle');
// There are 0 entities of this bundle with non-deleted data.
$query = new EntityFieldQuery;
$query = new EntityFieldQuery();
$found = $query
->fieldCondition($field)
->entityCondition('bundle', $bundle)
......@@ -2852,7 +2852,7 @@ class FieldBulkDeleteTestCase extends FieldTestCase {
// There are 10 entities of this bundle when deleted fields are allowed, and
// their values are correct.
$query = new EntityFieldQuery;
$query = new EntityFieldQuery();
$found = $query
->fieldCondition($field)
->entityCondition('bundle', $bundle)
......@@ -2889,7 +2889,7 @@ class FieldBulkDeleteTestCase extends FieldTestCase {
field_purge_batch($batch_size);
// There are $count deleted entities left.
$query = new EntityFieldQuery;
$query = new EntityFieldQuery();
$found = $query
->fieldCondition($field)
->entityCondition('bundle', $bundle)
......
......@@ -969,7 +969,7 @@ function file_get_file_references($file, $field = NULL, $age = FIELD_LOAD_REVISI
foreach ($fields as $field_name => $file_field) {
if ((empty($field_type) || $field['type'] == $field_type) && !isset($references[$field_name])) {
// Get each time this file is used within a field.
$query = new EntityFieldQuery;
$query = new EntityFieldQuery();
$query
->fieldCondition($file_field, 'fid', $file->fid)
->age($age);
......
......@@ -153,7 +153,7 @@ function filter_admin_format_form($form, &$form_state, $format) {
foreach ($filter_info as $name => $filter) {
// Create an empty filter object for new/unconfigured filters.
if (!isset($filters[$name])) {
$filters[$name] = new stdClass;
$filters[$name] = new stdClass();
$filters[$name]->status = 0;
$filters[$name]->weight = $filter['weight'];
$filters[$name]->settings = array();
......
......@@ -22,14 +22,14 @@ class FilterCRUDTestCase extends DrupalWebTestCase {
*/
function testTextFormatCRUD() {
// Add a text format with minimum data only.
$format = new stdClass;
$format = new stdClass();
$format->name = 'Empty format';
filter_format_save($format);
$this->verifyTextFormat($format);
$this->verifyFilters($format);
// Add another text format specifying all possible properties.
$format = new stdClass;
$format = new stdClass();
$format->name = 'Custom format';
$format->filters = array(
'filter_url' => array(
......@@ -877,7 +877,7 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
*/
function testFilter() {
// Setup dummy filter object.
$filter = new stdClass;
$filter = new stdClass();
$filter->settings = array(
'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>',
'filter_html_help' => 1,
......@@ -919,7 +919,7 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
*/
function testNoFollowFilter() {
// Setup dummy filter object.
$filter = new stdClass;
$filter = new stdClass();
$filter->settings = array(
'allowed_html' => '<a>',
'filter_html_help' => 1,
......@@ -982,7 +982,7 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
*/
function testUrlFilter() {
// Setup dummy filter object.
$filter = new stdClass;
$filter = new stdClass();
$filter->settings = array(
'filter_url_length' => 496,
);
......
......@@ -457,7 +457,7 @@ class OpenIDUnitTest extends DrupalWebTestCase {
'openid.baz' => 'abc3',
'foobar.foo' => 'abc4',
);
$association = new stdClass;
$association = new stdClass();
$association->mac_key = "1234567890abcdefghij\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9";
$this->assertEqual(_openid_signature($association, $response, array('foo', 'bar')), 'QnKZQzSFstT+GNiJDFOptdcZjrc=', t('Expected signature calculated.'));
}
......
......@@ -268,7 +268,7 @@ function _openid_test_endpoint_authenticate() {
);
// Sign the message using the MAC key that was exchanged during association.
$association = new stdClass;
$association = new stdClass();
$association->mac_key = variable_get('mac_key');
$keys_to_sign = explode(',', $response['openid.signed']);
$response['openid.sig'] = _openid_signature($association, $response, $keys_to_sign);
......
......@@ -12,7 +12,7 @@
function shortcut_install() {
$t = get_t();
// Create an initial default shortcut set.
$shortcut_set = new StdClass();
$shortcut_set = new stdClass();
$shortcut_set->title = $t('Default');
$shortcut_set->links = array(
array(
......
......@@ -48,7 +48,7 @@ class ShortcutTestCase extends DrupalWebTestCase {
* Creates a generic shortcut set.
*/
function generateShortcutSet($title = '', $default_links = TRUE) {
$set = new stdClass;
$set = new stdClass();
$set->title = empty($title) ? $this->randomName(10) : $title;
if ($default_links) {
$set->links = array();
......
......@@ -30,7 +30,7 @@ class DrupalAlterTestCase extends DrupalWebTestCase {
$base_theme_info = array();
$array = array('foo' => 'bar');
$entity = new stdClass;
$entity = new stdClass();
$entity->foo = 'bar';
// Verify alteration of a single argument.
......
......@@ -100,7 +100,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
// Create entities which have a 'bundle key' defined.
for ($i = 1; $i < 7; $i++) {
$entity = new stdClass;
$entity = new stdClass();
$entity->ftid = $i;
$entity->fttype = ($i < 5) ? 'bundle1' : 'bundle2';
......@@ -109,7 +109,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
field_attach_insert('test_entity_bundle_key', $entity);
}
$entity = new stdClass;
$entity = new stdClass();
$entity->ftid = 5;
$entity->fttype = 'bundle2';
$entity->{$this->field_names[1]}[LANGUAGE_NONE][0]['shape'] = 'square';
......@@ -127,7 +127,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
// Create entities with support for revisions.
for ($i = 1; $i < 5; $i++) {
$entity = new stdClass;
$entity = new stdClass();
$entity->ftid = $i;
$entity->ftvid = $i;
$entity->fttype = 'test_bundle';
......@@ -140,7 +140,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
// Add two revisions to an entity.
for ($i = 100; $i < 102; $i++) {
$entity = new stdClass;
$entity = new stdClass();
$entity->ftid = 4;
$entity->ftvid = $i;
$entity->fttype = 'test_bundle';
......@@ -753,7 +753,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
), t('Test offset on a field.'), TRUE);
for ($i = 6; $i < 10; $i++) {
$entity = new stdClass;
$entity = new stdClass();
$entity->ftid = $i;
$entity->{$this->field_names[0]}[LANGUAGE_NONE][0]['value'] = $i - 5;
drupal_write_record('test_entity_bundle', $entity);
......
......@@ -147,7 +147,7 @@ function system_admin_menu_block_page() {
function system_admin_by_module() {
$module_info = system_get_info('module');
foreach ($module_info as $module => $info) {
$module_info[$module] = new StdClass();
$module_info[$module] = new stdClass();
$module_info[$module]->info = $info;
}
uasort($module_info, 'system_sort_modules_by_info_name');
......
......@@ -2225,7 +2225,7 @@ function _system_rebuild_module_data() {
// Include the install profile in modules that are loaded.
$profile = drupal_get_profile();
$modules[$profile] = new stdClass;
$modules[$profile] = new stdClass();
$modules[$profile]->name = $profile;
$modules[$profile]->uri = 'profiles/' . $profile . '/' . $profile . '.profile';
$modules[$profile]->filename = $profile . '.profile';
......
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