Issue #2714829 by Mile23: Fix 'Generic.Functions.FunctionCallArgumentSpacing' coding standard

8.2.x
Alex Pott 2016-04-28 09:42:12 +01:00
parent 4c11b7a9d0
commit 4376b33cb3
18 changed files with 21 additions and 20 deletions

View File

@ -19,7 +19,7 @@ function config_help($route_name, RouteMatchInterface $route_match) {
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Exporting the full configuration') . '</dt>';
$output .= '<dd>' . t('You can create and download an archive consisting of all your site\'s configuration exported as <em>*.yml</em> files on the <a href=":url">Export</a> page.' , array(':url' => \Drupal::url('config.export_full'))) . '</dd>';
$output .= '<dd>' . t('You can create and download an archive consisting of all your site\'s configuration exported as <em>*.yml</em> files on the <a href=":url">Export</a> page.', array(':url' => \Drupal::url('config.export_full'))) . '</dd>';
$output .= '<dt>' . t('Importing a full configuration') . '</dt>';
$output .= '<dd>' . t('You can upload a full site configuration from an archive file on the <a href=":url">Import</a> page. When importing data from a different environment, the site and import files must have matching configuration values for UUID in the <em>system.site</em> configuration item. That means that your other environments should initially be set up as clones of the target site. Migrations are not supported.', array(':url' => \Drupal::url('config.import_full'))) . '</dd>';
$output .= '<dt>' . t('Synchronizing configuration'). '</dt>';

View File

@ -54,7 +54,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
$this->assertEqual(count($entity->{$this->fieldTestData->field_name}), $cardinality, 'Current revision: expected number of values');
for ($delta = 0; $delta < $cardinality; $delta++) {
// The field value loaded matches the one inserted or updated.
$this->assertEqual($entity->{$this->fieldTestData->field_name}[$delta]->value , $values[$current_revision][$delta]['value'], format_string('Current revision: expected value %delta was found.', array('%delta' => $delta)));
$this->assertEqual($entity->{$this->fieldTestData->field_name}[$delta]->value, $values[$current_revision][$delta]['value'], format_string('Current revision: expected value %delta was found.', array('%delta' => $delta)));
}
// Confirm each revision loads the correct data.

View File

@ -95,7 +95,7 @@ class FieldCrudTest extends FieldKernelTestBase {
$this->assertIdentical($config['description'], '', 'Description defaults to empty string.');
// Check that default settings are set.
$this->assertEqual($config['settings'], $field_type_manager->getDefaultFieldSettings($this->fieldStorageDefinition['type']) , 'Default field settings have been written.');
$this->assertEqual($config['settings'], $field_type_manager->getDefaultFieldSettings($this->fieldStorageDefinition['type']), 'Default field settings have been written.');
// Check that the denormalized 'field_type' was properly written.
$this->assertEqual($config['field_type'], $this->fieldStorageDefinition['type']);

View File

@ -95,7 +95,7 @@ class FieldConfigEditForm extends EntityForm {
// Add handling for default value.
if ($element = $items->defaultValuesForm($form, $form_state)) {
$element = array_merge($element , array(
$element = array_merge($element, array(
'#type' => 'details',
'#title' => $this->t('Default value'),
'#open' => TRUE,

View File

@ -33,7 +33,7 @@ function language_help($route_name, RouteMatchInterface $route_match) {
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Adding languages') . '</dt>';
$output .= '<dd>' . t('You can add languages on the <a href=":language_list">Languages</a> page by selecting <em>Add language</em> and choosing a language from the drop-down menu. This language is then displayed in the languages list, where it can be configured further. If the <a href=":interface">Interface translation module</a> is enabled, and the <em>translation server</em> is set as a translation source, then the interface translation for this language is automatically downloaded as well.' , array(':language_list' => \Drupal::url('entity.configurable_language.collection'), ':interface' => (\Drupal::moduleHandler()->moduleExists('locale')) ? \Drupal::url('help.page', array('name' => 'locale')) : '#')) . '</dd>';
$output .= '<dd>' . t('You can add languages on the <a href=":language_list">Languages</a> page by selecting <em>Add language</em> and choosing a language from the drop-down menu. This language is then displayed in the languages list, where it can be configured further. If the <a href=":interface">Interface translation module</a> is enabled, and the <em>translation server</em> is set as a translation source, then the interface translation for this language is automatically downloaded as well.', array(':language_list' => \Drupal::url('entity.configurable_language.collection'), ':interface' => (\Drupal::moduleHandler()->moduleExists('locale')) ? \Drupal::url('help.page', array('name' => 'locale')) : '#')) . '</dd>';
$output .= '<dt>' . t('Adding custom languages') . '</dt>';
$output .= '<dd>' . t('You can add a language that is not provided in the drop-down list by choosing <em>Custom language</em> at the end of the list. You then have to configure its language code, name, and direction in the form provided.') . '</dd>';
$output .= '<dt>' . t('Configuring content languages') . '</dt>';

View File

@ -224,7 +224,7 @@ class SearchQuery extends SelectExtender {
protected function parseSearchExpression() {
// Matches words optionally prefixed by a - sign. A word in this case is
// something between two spaces, optionally quoted.
preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->searchExpression , $keywords, PREG_SET_ORDER);
preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->searchExpression, $keywords, PREG_SET_ORDER);
if (count($keywords) == 0) {
return;

View File

@ -111,7 +111,7 @@ class ShortcutTranslationUITest extends ContentTranslationUITestBase {
$this->assertFalse(
$entity instanceof EntityChangedInterface,
format_string('%entity is not implementing EntityChangedInterface.' , array('%entity' => $this->entityTypeId))
format_string('%entity is not implementing EntityChangedInterface.', array('%entity' => $this->entityTypeId))
);
}

View File

@ -143,7 +143,7 @@ class ModulesUninstallConfirmForm extends ConfirmFormBase {
);
// List the dependent entities.
$this->addDependencyListsToForm($form, 'module', $this->modules , $this->configManager, $this->entityManager);
$this->addDependencyListsToForm($form, 'module', $this->modules, $this->configManager, $this->entityManager);
return parent::buildForm($form, $form_state);
}

View File

@ -280,7 +280,7 @@ class AttachedAssetsTest extends KernelTestBase {
$js_render_array = \Drupal::service('asset.js.collection_renderer')->render($js);
$rendered_js = $this->renderer->renderPlain($js_render_array);
$this->assertTrue(strpos($rendered_js, 'core/assets/vendor/backbone/backbone-min.js?v=1.2.3') > 0 && strpos($rendered_js, 'core/assets/vendor/domready/ready.min.js?v=1.0.8') > 0 , 'JavaScript version identifiers correctly appended to URLs');
$this->assertTrue(strpos($rendered_js, 'core/assets/vendor/backbone/backbone-min.js?v=1.2.3') > 0 && strpos($rendered_js, 'core/assets/vendor/domready/ready.min.js?v=1.0.8') > 0, 'JavaScript version identifiers correctly appended to URLs');
}
/**

View File

@ -50,7 +50,7 @@ class SessionTest extends WebTestBase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->getRawContent(), $matches);
$this->assertTrue(!empty($matches[1]) , 'Found session ID before logging in.');
$this->assertTrue(!empty($matches[1]), 'Found session ID before logging in.');
$original_session = $matches[1];
// We cannot use $this->drupalLogin($user); because we exit in
@ -67,7 +67,7 @@ class SessionTest extends WebTestBase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->getRawContent(), $matches);
$this->assertTrue(!empty($matches[1]) , 'Found session ID after logging in.');
$this->assertTrue(!empty($matches[1]), 'Found session ID after logging in.');
$this->assertTrue($matches[1] != $original_session, 'Session ID changed after login.');
}

View File

@ -49,7 +49,7 @@ class TermSelection extends DefaultSelection {
*/
public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
if ($match || $limit) {
return parent::getReferenceableEntities($match , $match_operator, $limit);
return parent::getReferenceableEntities($match, $match_operator, $limit);
}
$options = array();

View File

@ -46,11 +46,11 @@ function taxonomy_help($route_name, RouteMatchInterface $route_match) {
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Managing vocabularies') . '</dt>';
$output .= '<dd>' . t('Users who have the <em>Administer vocabularies and terms</em> permission can add and edit vocabularies from the <a href=":taxonomy_admin">Taxonomy administration page</a>. Vocabularies can be deleted from their <em>Edit vocabulary</em> page. Users with the <em>Taxonomy term: Administer fields</em> permission may add additional fields for terms in that vocabulary using the <a href=":field_ui">Field UI module</a>.' , array(':taxonomy_admin' => \Drupal::url('entity.taxonomy_vocabulary.collection'), ':field_ui' => $field_ui_url)) . '</dd>';
$output .= '<dd>' . t('Users who have the <em>Administer vocabularies and terms</em> permission can add and edit vocabularies from the <a href=":taxonomy_admin">Taxonomy administration page</a>. Vocabularies can be deleted from their <em>Edit vocabulary</em> page. Users with the <em>Taxonomy term: Administer fields</em> permission may add additional fields for terms in that vocabulary using the <a href=":field_ui">Field UI module</a>.', array(':taxonomy_admin' => \Drupal::url('entity.taxonomy_vocabulary.collection'), ':field_ui' => $field_ui_url)) . '</dd>';
$output .= '<dt>' . t('Managing terms') . '</dt>';
$output .= '<dd>' . t('Users who have the <em>Administer vocabularies and terms</em> permission or the <em>Edit terms</em> permission for a particular vocabulary can add, edit, and organize the terms in a vocabulary from a vocabulary\'s term listing page, which can be accessed by going to the <a href=":taxonomy_admin">Taxonomy administration page</a> and clicking <em>List terms</em> in the <em>Operations</em> column. Users must have the <em>Administer vocabularies and terms</em> permission or the <em>Delete terms</em> permission for a particular vocabulary to delete terms.' , array(':taxonomy_admin' => \Drupal::url('entity.taxonomy_vocabulary.collection'))) . ' </dd>';
$output .= '<dd>' . t('Users who have the <em>Administer vocabularies and terms</em> permission or the <em>Edit terms</em> permission for a particular vocabulary can add, edit, and organize the terms in a vocabulary from a vocabulary\'s term listing page, which can be accessed by going to the <a href=":taxonomy_admin">Taxonomy administration page</a> and clicking <em>List terms</em> in the <em>Operations</em> column. Users must have the <em>Administer vocabularies and terms</em> permission or the <em>Delete terms</em> permission for a particular vocabulary to delete terms.', array(':taxonomy_admin' => \Drupal::url('entity.taxonomy_vocabulary.collection'))) . ' </dd>';
$output .= '<dt>' . t('Classifying entity content') . '</dt>';
$output .= '<dd>' . t('A user with the <em>Administer fields</em> permission for a certain entity type may add <em>Taxonomy term</em> reference fields to the entity type, which will allow entities to be classified using taxonomy terms. See the <a href=":entity_reference">Entity Reference help</a> for more information about reference fields. See the <a href=":field">Field module help</a> and the <a href=":field_ui">Field UI help</a> pages for general information on fields and how to create and manage them.' , array(':field_ui' => $field_ui_url, ':field' => \Drupal::url('help.page', array('name' => 'field')), ':entity_reference' => \Drupal::url('help.page', array('name' => 'entity_reference')))) . '</dd>';
$output .= '<dd>' . t('A user with the <em>Administer fields</em> permission for a certain entity type may add <em>Taxonomy term</em> reference fields to the entity type, which will allow entities to be classified using taxonomy terms. See the <a href=":entity_reference">Entity Reference help</a> for more information about reference fields. See the <a href=":field">Field module help</a> and the <a href=":field_ui">Field UI help</a> pages for general information on fields and how to create and manage them.', array(':field_ui' => $field_ui_url, ':field' => \Drupal::url('help.page', array('name' => 'field')), ':entity_reference' => \Drupal::url('help.page', array('name' => 'entity_reference')))) . '</dd>';
$output .= '<dt>' . t('Adding new terms during content creation') . '</dt>';
$output .= '<dd>' . t('Allowing users to add new terms gradually builds a vocabulary as content is added and edited. Users can add new terms if either of the two <em>Autocomplete</em> widgets is chosen for the Taxonomy term reference field in the <em>Manage form display</em> page for the field. You will also need to enable the <em>Create referenced entities if they don\'t already exist</em> option, and restrict the field to one vocabulary.') . '</dd>';
$output .= '<dt>' . t('Configuring displays and form displays') . '</dt>';

View File

@ -34,7 +34,7 @@ class MigrateUserConfigsTest extends MigrateDrupal6TestBase {
$this->assertIdentical('Account details for [user:name] at [site:name] (approved)', $config->get('status_activated.subject'));
$this->assertIdentical("[user:name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n[user:one-time-login-url]\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.\n\nOnce you have set your own password, you will be able to log in to [site:login-url] in the future using:\n\nusername: [user:name]\n", $config->get('status_activated.body'));
$this->assertIdentical('Replacement login information for [user:name] at [site:name]', $config->get('password_reset.subject'));
$this->assertIdentical("[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in to [site:url-brief] by clicking on this link or copying and pasting it in your browser:\n\n[user:one-time-login-url]\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password." , $config->get('password_reset.body'));
$this->assertIdentical("[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in to [site:url-brief] by clicking on this link or copying and pasting it in your browser:\n\n[user:one-time-login-url]\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.", $config->get('password_reset.body'));
$this->assertIdentical('Account details for [user:name] at [site:name] (deleted)', $config->get('cancel_confirm.subject'));
$this->assertIdentical("[user:name],\n\nYour account on [site:name] has been deleted.", $config->get('cancel_confirm.body'));
$this->assertIdentical('An administrator created an account for you at [site:name]', $config->get('register_admin_created.subject'));

View File

@ -107,7 +107,7 @@ class PreviewTest extends UITestBase {
$this->assertText("SELECT views_test_data.name AS views_test_data_name\nFROM \n{views_test_data} views_test_data\nWHERE (( (views_test_data.id = &#039;100&#039; ) ))");
// Test that the statistics and query are rendered above the preview.
$this->assertTrue(strpos($this->getRawContent(), 'views-query-info') < strpos($this->getRawContent(), 'view-test-preview') , 'Statistics shown above the preview.');
$this->assertTrue(strpos($this->getRawContent(), 'views-query-info') < strpos($this->getRawContent(), 'view-test-preview'), 'Statistics shown above the preview.');
// Test that statistics and query rendered below the preview.
$settings->set('ui.show.sql_query.where', 'below')->save();

View File

@ -25,7 +25,7 @@ class RedirectTest extends UITestBase {
$random_destination = $this->randomMachineName();
$edit_path = "admin/structure/views/view/$view_name/edit";
$this->drupalPostForm($edit_path, array(), t('Save') , array('query' => array('destination' => $random_destination)));
$this->drupalPostForm($edit_path, array(), t('Save'), array('query' => array('destination' => $random_destination)));
$this->assertUrl($random_destination, array(), 'Make sure the user got redirected to the expected page defined in the destination.');
// Setup a view with a certain page display path. If you change the path

View File

@ -41,6 +41,7 @@
<!-- Generic sniffs -->
<rule ref="Generic.Files.LineEndings"/>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>

View File

@ -158,7 +158,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase {
// Test a view mode in default conditions: render caching is enabled for
// the entity type and the view mode.
$build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
$this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age', 'keys', 'bin'] , 'A view mode with render cache enabled has the correct output (cache tags, keys, contexts, max-age and bin).');
$this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age', 'keys', 'bin'], 'A view mode with render cache enabled has the correct output (cache tags, keys, contexts, max-age and bin).');
// Test that a view mode can opt out of render caching.
$build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'test');

View File

@ -512,7 +512,7 @@ class UrlTest extends UnitTestCase {
$route_match = new RouteMatch('test_route', $route, ['foo' => (object) [1]], ['foo' => 1]);
$url = Url::fromRouteMatch($route_match);
$this->assertSame('test_route', $url->getRouteName());
$this->assertEquals(['foo' => '1'] , $url->getRouteParameters());
$this->assertEquals(['foo' => '1'], $url->getRouteParameters());
}
/**