Unverified Commit 6c40e077 authored by alexpott's avatar alexpott

Issue #2937853 by idebr, mfernea, SherFengChong, alexpott, borisson_: Fix...

Issue #2937853 by idebr, mfernea, SherFengChong, alexpott, borisson_: Fix 'Drupal.Formatting.MultipleStatementAlignment' coding standard
parent 500403b4
......@@ -1371,9 +1371,9 @@ function template_preprocess_page(&$variables) {
}
}
$variables['base_path'] = base_path();
$variables['front_page'] = \Drupal::url('<front>');
$variables['language'] = $language_interface;
$variables['base_path'] = base_path();
$variables['front_page'] = \Drupal::url('<front>');
$variables['language'] = $language_interface;
// An exception might be thrown.
try {
......
......@@ -41,7 +41,7 @@ class DateTimePlus {
use ToStringTrait;
const FORMAT = 'Y-m-d H:i:s';
const FORMAT = 'Y-m-d H:i:s';
/**
* A RFC7231 Compliant date.
......
......@@ -189,7 +189,7 @@ protected function processCss($contents, $optimize = FALSE) {
if ($optimize) {
// Perform some safe CSS optimizations.
// Regexp to match comment blocks.
$comment = '/\*[^*]*\*+(?:[^/*][^*]*\*+)*/';
$comment = '/\*[^*]*\*+(?:[^/*][^*]*\*+)*/';
// Regexp to match double quoted strings.
$double_quot = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
// Regexp to match single quoted strings.
......
......@@ -74,7 +74,7 @@ protected function getMaxRowsForBin($bin) {
$max_rows_settings = $this->settings->get('database_cache_max_rows');
// First, look for a cache bin specific setting.
if (isset($max_rows_settings['bins'][$bin])) {
$max_rows = $max_rows_settings['bins'][$bin];
$max_rows = $max_rows_settings['bins'][$bin];
}
// Second, use configured default backend.
elseif (isset($max_rows_settings['default'])) {
......
......@@ -145,7 +145,7 @@ protected function getTableSchema(Connection $connection, $table) {
$name = $row['Field'];
// Parse out the field type and meta information.
preg_match('@([a-z]+)(?:\((\d+)(?:,(\d+))?\))?\s*(unsigned)?@', $row['Type'], $matches);
$type = $this->fieldTypeMap($connection, $matches[1]);
$type = $this->fieldTypeMap($connection, $matches[1]);
if ($row['Extra'] === 'auto_increment') {
// If this is an auto increment, then the type is 'serial'.
$type = 'serial';
......
......@@ -70,8 +70,8 @@ public function getInfo() {
*/
public static function valueCallback(&$element, $input, FormStateInterface $form_state) {
if ($input !== FALSE) {
$date_input = $element['#date_date_element'] != 'none' && !empty($input['date']) ? $input['date'] : '';
$time_input = $element['#date_time_element'] != 'none' && !empty($input['time']) ? $input['time'] : '';
$date_input = $element['#date_date_element'] != 'none' && !empty($input['date']) ? $input['date'] : '';
$time_input = $element['#date_time_element'] != 'none' && !empty($input['time']) ? $input['time'] : '';
$date_format = $element['#date_date_element'] != 'none' ? static::getHtml5DateFormat($element) : '';
$time_format = $element['#date_time_element'] != 'none' ? static::getHtml5TimeFormat($element) : '';
$timezone = !empty($element['#date_timezone']) ? $element['#date_timezone'] : NULL;
......
......@@ -401,7 +401,7 @@ public function getAllRoutes() {
* {@inheritdoc}
*/
public function reset() {
$this->routes = [];
$this->routes = [];
$this->serializedRoutes = [];
$this->cacheTagInvalidator->invalidateTags(['routes']);
}
......
......@@ -28,7 +28,7 @@ public function testEmptyActionList() {
// Ensure the empty text appears on the action list page.
/** @var $storage \Drupal\Core\Entity\EntityStorageInterface */
$storage = $this->container->get('entity.manager')->getStorage('action');
$actions = $storage->loadMultiple();
$actions = $storage->loadMultiple();
$storage->delete($actions);
$this->drupalGet('/admin/config/system/actions');
$this->assertRaw('There are no actions yet.');
......
......@@ -179,7 +179,7 @@ function comment_tokens($type, $tokens, array $data, array $options, BubbleableM
// Comment related URLs.
case 'url':
$url_options['fragment'] = 'comment-' . $comment->id();
$url_options['fragment'] = 'comment-' . $comment->id();
$replacements[$original] = $comment->url('canonical', $url_options);
break;
......
......@@ -235,7 +235,7 @@ public function getViewsData() {
// Define the base group of this table. Fields that don't have a group defined
// will go into this field by default.
$data['comment_entity_statistics']['table']['group'] = $this->t('Comment Statistics');
$data['comment_entity_statistics']['table']['group'] = $this->t('Comment Statistics');
// Provide a relationship for each entity type except comment.
foreach ($entities_types as $type => $entity_type) {
......
......@@ -413,7 +413,7 @@ public function topLogMessages($type) {
}
}
$build['dblog_top_table'] = [
$build['dblog_top_table'] = [
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
......
......@@ -65,7 +65,7 @@ public function getViewsData() {
$data['file_managed']['uid']['relationship']['title'] = $this->t('User who uploaded');
$data['file_managed']['uid']['relationship']['label'] = $this->t('User who uploaded');
$data['file_usage']['table']['group'] = $this->t('File Usage');
$data['file_usage']['table']['group'] = $this->t('File Usage');
// Provide field-type-things to several base tables; on the core files table
// ("file_managed") so that we can create relationships from files to
......
......@@ -62,7 +62,7 @@ protected function doPrivateFileTransferTest() {
$file->setPermanent();
$file->save();
$url = file_create_url($file->getFileUri());
$url = file_create_url($file->getFileUri());
// Set file_test access header to allow the download.
file_test_set_return('download', ['x-foo' => 'Bar']);
......
......@@ -77,7 +77,7 @@ public function save(array $form, FormStateInterface $form_state) {
$status = $term_storage->save($term);
$route_name = $this->urlStub == 'container' ? 'entity.taxonomy_term.forum_edit_container_form' : 'entity.taxonomy_term.forum_edit_form';
$route_parameters = ['taxonomy_term' => $term->id()];
$route_parameters = ['taxonomy_term' => $term->id()];
$link = $this->l($this->t('Edit'), new Url($route_name, $route_parameters));
$view_link = $term->link($term->getName());
switch ($status) {
......
......@@ -27,7 +27,7 @@
function history_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.history':
$output = '<h3>' . t('About') . '</h3>';
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The History module keeps track of which content a user has read. It marks content as <em>new</em> or <em>updated</em> depending on the last time the user viewed it. History records that are older than one month are removed during cron, which means that content older than one month is always considered <em>read</em>. The History module does not have a user interface but it provides a filter to <a href=":views-help">Views</a> to show new or updated content. For more information, see the <a href=":url">online documentation for the History module</a>.', [':views-help' => (\Drupal::moduleHandler()->moduleExists('views')) ? \Drupal::url('help.page', ['name' => 'views']) : '#', ':url' => 'https://www.drupal.org/documentation/modules/history']) . '</p>';
return $output;
}
......
......@@ -14,7 +14,7 @@ function history_views_data() {
// We're actually defining a specific instance of the table, so let's
// alias it so that we can later add the real table for other purposes if we
// need it.
$data['history']['table']['group'] = t('Content');
$data['history']['table']['group'] = t('Content');
// Explain how this table joins to others.
$data['history']['table']['join'] = [
......
......@@ -161,7 +161,7 @@ function locale_translation_default_translation_server() {
// An additional check is required here. During the upgrade process
// \Drupal::config()->get() returns NULL. We use the defined value as
// fallback.
$pattern = $pattern ? $pattern : LOCALE_TRANSLATION_DEFAULT_SERVER_PATTERN;
$pattern = $pattern ? $pattern : LOCALE_TRANSLATION_DEFAULT_SERVER_PATTERN;
return [
'pattern' => $pattern,
......
......@@ -662,7 +662,7 @@ public function checkInvalidParentMenuLinks() {
$this->drupalPostForm("admin/structure/menu/manage/{$this->menu->id()}/add", $edit, t('Save'));
$menu_links = entity_load_multiple_by_properties('menu_link_content', ['title' => $title]);
$last_link = reset($menu_links);
$created_links[] = 'tools:' . $last_link->getPluginId();
$created_links[] = 'tools:' . $last_link->getPluginId();
}
// The last link cannot be a parent in the new menu link form.
......
......@@ -83,7 +83,7 @@ protected function getDiscovery() {
// This gets rid of migrations which try to use a non-existent source
// plugin. The common case for this is if the source plugin has, or
// specifies, a non-existent provider.
$only_with_source_discovery = new NoSourcePluginDecorator($yaml_discovery);
$only_with_source_discovery = new NoSourcePluginDecorator($yaml_discovery);
// This gets rid of migrations with explicit providers set if one of the
// providers do not exist before we try to use a potentially non-existing
// deriver. This is a rare case.
......
......@@ -124,7 +124,7 @@ public function form(array $form, FormStateInterface $form_state) {
DRUPAL_REQUIRED => t('Required'),
],
];
$form['submission']['help'] = [
$form['submission']['help'] = [
'#type' => 'textarea',
'#title' => t('Explanation or submission guidelines'),
'#default_value' => $type->getHelp(),
......
......@@ -280,7 +280,7 @@ public function getViewsData() {
// Define the base group of this table. Fields that don't have a group defined
// will go into this field by default.
$data['node_access']['table']['group'] = $this->t('Content access');
$data['node_access']['table']['group'] = $this->t('Content access');
// For other base tables, explain how we join.
$data['node_access']['table']['join'] = [
......
......@@ -789,7 +789,7 @@ public function testPost() {
// Try with all of the following request bodies.
$unparseable_request_body = '!{>}<';
$parseable_valid_request_body = $this->serializer->encode($this->getNormalizedPostEntity(), static::$format);
$parseable_valid_request_body = $this->serializer->encode($this->getNormalizedPostEntity(), static::$format);
$parseable_valid_request_body_2 = $this->serializer->encode($this->getSecondNormalizedPostEntity(), static::$format);
$parseable_invalid_request_body = $this->serializer->encode($this->makeNormalizationInvalid($this->getNormalizedPostEntity(), 'label'), static::$format);
$parseable_invalid_request_body_2 = $this->serializer->encode($this->getNormalizedPostEntity() + ['uuid' => [$this->randomMachineName(129)]], static::$format);
......@@ -1018,9 +1018,9 @@ public function testPatch() {
$has_canonical_url = $this->entity->hasLinkTemplate('canonical');
// Try with all of the following request bodies.
$unparseable_request_body = '!{>}<';
$parseable_valid_request_body = $this->serializer->encode($this->getNormalizedPatchEntity(), static::$format);
$parseable_valid_request_body_2 = $this->serializer->encode($this->getNormalizedPatchEntity(), static::$format);
$unparseable_request_body = '!{>}<';
$parseable_valid_request_body = $this->serializer->encode($this->getNormalizedPatchEntity(), static::$format);
$parseable_valid_request_body_2 = $this->serializer->encode($this->getNormalizedPatchEntity(), static::$format);
$parseable_invalid_request_body = $this->serializer->encode($this->makeNormalizationInvalid($this->getNormalizedPatchEntity(), 'label'), static::$format);
$parseable_invalid_request_body_2 = $this->serializer->encode($this->getNormalizedPatchEntity() + ['field_rest_test' => [['value' => $this->randomString()]]], static::$format);
// The 'field_rest_test' field does not allow 'view' access, so does not end
......
......@@ -29,7 +29,7 @@ public function normalize($object, $format = NULL, array $context = []) {
*/
protected function constructValue($data, $context) {
$value = parent::constructValue($data, $context);
$value['value'] = str_replace('::silly_suffix', '', $value['value']);
$value['value'] = str_replace('::silly_suffix', '', $value['value']);
return $value;
}
......
......@@ -9,7 +9,7 @@
* Implements hook_views_data().
*/
function statistics_views_data() {
$data['node_counter']['table']['group'] = t('Content statistics');
$data['node_counter']['table']['group'] = t('Content statistics');
$data['node_counter']['table']['join'] = [
'node_field_data' => [
......
......@@ -187,7 +187,7 @@ public function themesPage() {
uasort($themes, 'system_sort_modules_by_info_name');
$theme_default = $config->get('default');
$theme_groups = ['installed' => [], 'uninstalled' => []];
$theme_groups = ['installed' => [], 'uninstalled' => []];
$admin_theme = $config->get('admin');
$admin_theme_options = [];
......
......@@ -99,7 +99,7 @@ function entity_test_update_entity_presave(EntityInterface $entity) {
*/
function _entity_test_update_create_test_entities($start = 1, $end = 50, $add_translation = FALSE) {
for ($i = $start; $i <= $end; $i++) {
$entity = EntityTestUpdate::create([
$entity = EntityTestUpdate::create([
'id' => $i,
'name' => $i,
'test_single_property' => $i . ' - test single property',
......
......@@ -27,7 +27,7 @@ protected function setUp() {
// Unset the sync directory in settings.php to trigger $config_directories
// error.
$settings['config_directories'] = [
$settings['config_directories'] = [
CONFIG_SYNC_DIRECTORY => (object) [
'value' => '',
'required' => TRUE,
......
......@@ -133,7 +133,7 @@ public function getViewsData() {
],
];
$data['taxonomy_index']['table']['group'] = $this->t('Taxonomy term');
$data['taxonomy_index']['table']['group'] = $this->t('Taxonomy term');
$data['taxonomy_index']['table']['join'] = [
'taxonomy_term_field_data' => [
......
......@@ -82,7 +82,7 @@ public function preRender(&$values) {
$ordered_roles = array_flip(array_keys($roles));
foreach ($this->items as &$user_roles) {
// Create an array of rids that the user has in the role weight order.
$sorted_keys = array_intersect_key($ordered_roles, $user_roles);
$sorted_keys = array_intersect_key($ordered_roles, $user_roles);
// Merge with the unsorted array of role information which has the
// effect of sorting it.
$user_roles = array_merge($sorted_keys, $user_roles);
......
......@@ -491,7 +491,7 @@ function template_preprocess_username(&$variables) {
// unsanitized version, in case other preprocess functions want to implement
// their own shortening logic or add markup. If they do so, they must ensure
// that $variables['name'] is safe for printing.
$name = $account->getDisplayName();
$name = $account->getDisplayName();
$variables['name_raw'] = $account->getUsername();
if (mb_strlen($name) > 20) {
$name = Unicode::truncate($name, 15, FALSE, TRUE);
......
......@@ -140,7 +140,7 @@ protected function defineOptions() {
// Overrides for standard stuff.
$options['style']['contains']['type']['default'] = 'rss';
$options['style']['contains']['options']['default'] = ['description' => ''];
$options['style']['contains']['options']['default'] = ['description' => ''];
$options['sitename_title']['default'] = FALSE;
$options['row']['contains']['type']['default'] = 'rss_fields';
$options['defaults']['default']['style'] = FALSE;
......
......@@ -1513,7 +1513,7 @@ public function execute(ViewExecutable $view) {
if (!empty($this->limit) || !empty($this->offset)) {
// We can't have an offset without a limit, so provide a very large limit instead.
$limit = intval(!empty($this->limit) ? $this->limit : 999999);
$limit = intval(!empty($this->limit) ? $this->limit : 999999);
$offset = intval(!empty($this->offset) ? $this->offset : 0);
$query->range($offset, $limit);
}
......
......@@ -176,7 +176,7 @@ protected function setupBaseFields(array $base_fields) {
->setSetting('max_length', 255);
// A base field with cardinality > 1
$base_fields['string'] = BaseFieldDefinition::create('string')
$base_fields['string'] = BaseFieldDefinition::create('string')
->setLabel('Strong')
->setTranslatable(TRUE)
->setCardinality(2);
......
......@@ -811,7 +811,7 @@ function template_preprocess_views_view_unformatted(&$variables) {
* - view: A View object.
*/
function template_preprocess_views_view_list(&$variables) {
$handler = $variables['view']->style_plugin;
$handler = $variables['view']->style_plugin;
// Fetch classes from handler options.
if ($handler->options['class']) {
......@@ -844,7 +844,7 @@ function template_preprocess_views_view_list(&$variables) {
* - rows: The raw row data.
*/
function template_preprocess_views_view_rss(&$variables) {
$view = $variables['view'];
$view = $variables['view'];
$items = $variables['rows'];
$style = $view->style_plugin;
......@@ -945,7 +945,7 @@ function template_preprocess_views_view_row_rss(&$variables) {
* - rows: The raw row data.
*/
function template_preprocess_views_view_opml(&$variables) {
$view = $variables['view'];
$view = $variables['view'];
$items = $variables['rows'];
$config = \Drupal::config('system.site');
......
......@@ -99,6 +99,7 @@
<rule ref="Drupal.Files.FileEncoding"/>
<rule ref="Drupal.Files.TxtFileLineLength"/>
<rule ref="Drupal.Formatting.MultiLineAssignment"/>
<rule ref="Drupal.Formatting.MultipleStatementAlignment"/>
<rule ref="Drupal.Formatting.SpaceInlineIf"/>
<rule ref="Drupal.Formatting.SpaceUnaryOperator"/>
<rule ref="Drupal.Functions.DiscouragedFunctions"/>
......
......@@ -58,8 +58,8 @@
exit;
}
// define default settings
$cmd = 'index.php';
// define default settings
$_SERVER['HTTP_HOST'] = 'default';
$_SERVER['PHP_SELF'] = '/index.php';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
......
......@@ -17,7 +17,7 @@
}
if (version_compare(PHP_VERSION, '5.4.5') < 0) {
$version = PHP_VERSION;
$version = PHP_VERSION;
echo <<<EOF
ERROR: This script requires at least PHP version 5.4.5. You invoked it with
......
......@@ -204,7 +204,7 @@ public function testSettings() {
$end = strrpos($rendered_js, $endToken);
// Convert to a string, as $renderer_js is a \Drupal\Core\Render\Markup
// object.
$json = mb_substr($rendered_js, $start, $end - $start + 1);
$json = mb_substr($rendered_js, $start, $end - $start + 1);
$parsed_settings = Json::decode($json);
// Test whether the settings for core/drupalSettings are available.
......
......@@ -31,7 +31,7 @@ class ToolkitGdTest extends KernelTestBase {
protected $white = [255, 255, 255, 0];
protected $transparent = [0, 0, 0, 127];
// Used as rotate background colors.
protected $fuchsia = [255, 0, 255, 0];
protected $fuchsia = [255, 0, 255, 0];
protected $rotateTransparent = [255, 255, 255, 127];
protected $width = 40;
......
......@@ -31,7 +31,7 @@ protected function setUp() {
*/
public function testGetDefinitions() {
// Path to the classes which we'll discover and parse annotation.
$discovery_path = __DIR__ . '/Fixtures';
$discovery_path = __DIR__ . '/Fixtures';
// File path that should be discovered within that directory.
$file_path = $discovery_path . '/PluginNamespace/DiscoveryTest1.php';
......
......@@ -61,7 +61,7 @@ function ($foo) {}, [], ['foo' => NULL], [], [NULL],
// Test with a raw value that overrides the provided upcast value, since
// it is not typehinted.
$scalars = ['foo' => 'baz'];
$scalars = ['foo' => 'baz'];
$objects = ['foo' => new \stdClass()];
$data[] = [
function ($foo) {}, $scalars, $objects, [], ['baz'],
......
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