From cb123cf554b58de2bcb9e472f684390404ee5ba4 Mon Sep 17 00:00:00 2001 From: Sally Young <git@justa.fish> Date: Fri, 20 Oct 2023 13:59:03 +0100 Subject: [PATCH] Issue #3392425 by quietone, smustgrave: Fix variable name spelling in non-tests, part1 --- core/lib/Drupal/Core/Datetime/DateHelper.php | 8 ++--- .../Core/Datetime/TimeZoneFormHelper.php | 4 +-- .../Core/Extension/ExtensionDiscovery.php | 16 +++++----- .../Drupal/Core/FileTransfer/FTPExtension.php | 6 ++-- .../Drupal/Core/StreamWrapper/LocalStream.php | 8 ++--- core/misc/cspell/dictionary.txt | 20 ------------- core/modules/filter/filter.module | 16 +++++----- core/modules/locale/locale.module | 4 +-- .../locale/src/Form/TranslateEditForm.php | 10 +++---- .../media/src/Form/EditorMediaDialog.php | 4 +-- .../src/Driver/Database/mysql/Schema.php | 6 ++-- .../node/src/Controller/NodeController.php | 4 +-- .../node/src/NodeGrantDatabaseStorage.php | 4 +-- .../src/Driver/Database/pgsql/Schema.php | 6 ++-- core/modules/search/src/SearchIndex.php | 30 +++++++++---------- core/modules/search/src/SearchQuery.php | 8 ++--- .../taxonomy/src/Form/OverviewTerms.php | 4 +-- core/modules/text/text.module | 14 ++++----- core/modules/user/user.module | 12 ++++---- core/scripts/generate-d6-content.sh | 6 ++-- core/scripts/generate-d7-content.sh | 6 ++-- 21 files changed, 88 insertions(+), 108 deletions(-) diff --git a/core/lib/Drupal/Core/Datetime/DateHelper.php b/core/lib/Drupal/Core/Datetime/DateHelper.php index 6eabebfd3329..927afdf6c0b4 100644 --- a/core/lib/Drupal/Core/Datetime/DateHelper.php +++ b/core/lib/Drupal/Core/Datetime/DateHelper.php @@ -81,7 +81,7 @@ public static function monthNamesAbbrUntranslated() { public static function monthNames($required = FALSE) { // Force the key to use the correct month value, rather than // starting with zero. - $monthnames = [ + $month_names = [ 1 => t('January', [], ['context' => 'Long month name']), 2 => t('February', [], ['context' => 'Long month name']), 3 => t('March', [], ['context' => 'Long month name']), @@ -96,7 +96,7 @@ public static function monthNames($required = FALSE) { 12 => t('December', [], ['context' => 'Long month name']), ]; $none = ['' => '']; - return !$required ? $none + $monthnames : $monthnames; + return !$required ? $none + $month_names : $month_names; } /** @@ -112,7 +112,7 @@ public static function monthNames($required = FALSE) { public static function monthNamesAbbr($required = FALSE) { // Force the key to use the correct month value, rather than // starting with zero. - $monthnames = [ + $month_names = [ 1 => t('Jan', [], ['context' => 'Abbreviated month name']), 2 => t('Feb', [], ['context' => 'Abbreviated month name']), 3 => t('Mar', [], ['context' => 'Abbreviated month name']), @@ -127,7 +127,7 @@ public static function monthNamesAbbr($required = FALSE) { 12 => t('Dec', [], ['context' => 'Abbreviated month name']), ]; $none = ['' => '']; - return !$required ? $none + $monthnames : $monthnames; + return !$required ? $none + $month_names : $month_names; } /** diff --git a/core/lib/Drupal/Core/Datetime/TimeZoneFormHelper.php b/core/lib/Drupal/Core/Datetime/TimeZoneFormHelper.php index e79d6cbe1a7f..b45c1d88d0d4 100644 --- a/core/lib/Drupal/Core/Datetime/TimeZoneFormHelper.php +++ b/core/lib/Drupal/Core/Datetime/TimeZoneFormHelper.php @@ -25,9 +25,9 @@ class TimeZoneFormHelper { * \DateTimeZone::listIdentifiers() */ public static function getOptionsList(bool $blank = FALSE): array { - $zonelist = \DateTimeZone::listIdentifiers(); + $zone_list = \DateTimeZone::listIdentifiers(); $zones = $blank ? ['' => new TranslatableMarkup('- None selected -')] : []; - foreach ($zonelist as $zone) { + foreach ($zone_list as $zone) { $zones[$zone] = new TranslatableMarkup(str_replace('_', ' ', $zone)); } // Sort the translated time zones alphabetically. diff --git a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php index ce85bd1e5dc5..b0cfa7d13e5a 100644 --- a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php +++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php @@ -158,15 +158,15 @@ public function scan($type, $include_tests = NULL) { } // Search the core directory. - $searchdirs[static::ORIGIN_CORE] = 'core'; + $search_dirs[static::ORIGIN_CORE] = 'core'; // Search the legacy sites/all directory. - $searchdirs[static::ORIGIN_SITES_ALL] = 'sites/all'; + $search_dirs[static::ORIGIN_SITES_ALL] = 'sites/all'; // Search for contributed and custom extensions in top-level directories. // The scan uses a list of extension types to limit recursion to the // expected extension type specific directory names only. - $searchdirs[static::ORIGIN_ROOT] = ''; + $search_dirs[static::ORIGIN_ROOT] = ''; // Tests use the regular built-in multi-site functionality of Drupal for // running web tests. As a consequence, extensions of the parent site @@ -176,7 +176,7 @@ public function scan($type, $include_tests = NULL) { // so that contained extensions are still discovered. // @see \Drupal\Core\Test\FunctionalTestSetupTrait::prepareSettings(). if ($parent_site = Settings::get('test_parent_site')) { - $searchdirs[static::ORIGIN_PARENT_SITE] = $parent_site; + $search_dirs[static::ORIGIN_PARENT_SITE] = $parent_site; } // Find the site-specific directory to search. Since we are using this @@ -184,10 +184,10 @@ public function scan($type, $include_tests = NULL) { // at install time. Therefore Kernel service is not always available, but is // preferred. if (\Drupal::hasService('kernel')) { - $searchdirs[static::ORIGIN_SITE] = \Drupal::getContainer()->getParameter('site.path'); + $search_dirs[static::ORIGIN_SITE] = \Drupal::getContainer()->getParameter('site.path'); } else { - $searchdirs[static::ORIGIN_SITE] = $this->sitePath ?: DrupalKernel::findSitePath(Request::createFromGlobals()); + $search_dirs[static::ORIGIN_SITE] = $this->sitePath ?: DrupalKernel::findSitePath(Request::createFromGlobals()); } // Unless an explicit value has been passed, manually check whether we are @@ -199,7 +199,7 @@ public function scan($type, $include_tests = NULL) { } $files = []; - foreach ($searchdirs as $dir) { + foreach ($search_dirs as $dir) { // Discover all extensions in the directory, unless we did already. if (!isset(static::$files[$this->root][$dir][$include_tests])) { static::$files[$this->root][$dir][$include_tests] = $this->scanDirectory($dir, $include_tests); @@ -214,7 +214,7 @@ public function scan($type, $include_tests = NULL) { // installation profiles. $files = $this->filterByProfileDirectories($files); // Sort the discovered extensions by their originating directories. - $origin_weights = array_flip($searchdirs); + $origin_weights = array_flip($search_dirs); $files = $this->sort($files, $origin_weights); // Process and return the list of extensions keyed by extension name. diff --git a/core/lib/Drupal/Core/FileTransfer/FTPExtension.php b/core/lib/Drupal/Core/FileTransfer/FTPExtension.php index 74da1b0dcf28..27682fe74125 100644 --- a/core/lib/Drupal/Core/FileTransfer/FTPExtension.php +++ b/core/lib/Drupal/Core/FileTransfer/FTPExtension.php @@ -106,12 +106,12 @@ public function chmodJailed($path, $mode, $recursive) { throw new FileTransferException("Unable to set permissions on %file", 0, ['%file' => $path]); } if ($this->isDirectory($path) && $recursive) { - $filelist = @ftp_nlist($this->connection, $path); - if (!$filelist) { + $file_list = @ftp_nlist($this->connection, $path); + if (!$file_list) { // empty directory - returns false return; } - foreach ($filelist as $file) { + foreach ($file_list as $file) { $this->chmodJailed($file, $mode, $recursive); } } diff --git a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php index 23e67d282937..01a8e24c9f85 100644 --- a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php +++ b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php @@ -335,18 +335,18 @@ public function mkdir($uri, $mode, $options) { if ($recursive) { // $this->getLocalPath() fails if $uri has multiple levels of directories // that do not yet exist. - $localpath = $this->getDirectoryPath() . '/' . $this->getTarget($uri); + $local_path = $this->getDirectoryPath() . '/' . $this->getTarget($uri); } else { - $localpath = $this->getLocalPath($uri); + $local_path = $this->getLocalPath($uri); } /** @var \Drupal\Core\File\FileSystemInterface $file_system */ $file_system = \Drupal::service('file_system'); if ($options & STREAM_REPORT_ERRORS) { - return $file_system->mkdir($localpath, $mode, $recursive); + return $file_system->mkdir($local_path, $mode, $recursive); } else { - return @$file_system->mkdir($localpath, $mode, $recursive); + return @$file_system->mkdir($local_path, $mode, $recursive); } } diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt index b943ea80d243..6f549cb648d3 100644 --- a/core/misc/cspell/dictionary.txt +++ b/core/misc/cspell/dictionary.txt @@ -2,7 +2,6 @@ abcdefghijkmnopqrstuvwxyz abcdefghjklmnpqrstuvwxyz absolutezero accesslog -accum adamson addedline addtogroup @@ -393,14 +392,12 @@ fieldlayout fieldlinks fieldnames fieldsets -filelist filemime filesort filesystems filetransfer filevalidationerror findwith -fixnull flickr flipfit foat @@ -482,7 +479,6 @@ idekey idempotency iframes iframeupload -ignoretag imagecache imagecreatefrom imagetextalternative @@ -539,10 +535,8 @@ labely lamoids langcode langcodes -langname languageswitcher lazybuilder -lcode libc libmysqlclient licious @@ -564,7 +558,6 @@ lnumber loadjs localemark localetranslatedirty -localpath lolspeak longblob longerthan @@ -596,7 +589,6 @@ mediaimagetextalternativeediting mediaimagetextalternativeui mediumint mediumtext -membersonly merhaba messagekey metapackage @@ -624,7 +616,6 @@ modernizr modulenarrow mojito montag -monthnames mooooh msgctxt msgid @@ -655,12 +646,10 @@ mysite mysqladmin mysqldump mystarterkit -nalias nameofbin namespacing navs nbaz -nbchoices ndocs nearbykeyword necolas @@ -824,10 +813,8 @@ proxied proxying pseudotag ptablenode -pterm puzzlepiece pwprompt -queryor querystring questionmark quicklinks @@ -894,7 +881,6 @@ ritchie routable routeable rowspans -rpos rsyslog rtsp ruleset @@ -913,7 +899,6 @@ schipulcon scorewords scriptable scrollbars -searchdirs sebastianbergmann sebe seld @@ -1037,8 +1022,6 @@ tablesort's tablesorts tabset tabwidth -tagstack -tagwords takeshita tappable tarz @@ -1109,7 +1092,6 @@ timespan timetime tinyint tinytext -tiplist titel titlealert titlebar @@ -1125,7 +1107,6 @@ topop torder totalcount touchevents -tparams trackback trailingslash transferthick @@ -1290,7 +1271,6 @@ zettabytes zipf's zomg zoneinfo -zonelist zoomin zoomout zwei diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 2d98b6e43cd8..e30b6ee4139f 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -421,15 +421,15 @@ function template_preprocess_text_format_wrapper(&$variables) { function template_preprocess_filter_tips(&$variables) { $tips = $variables['tips']; - foreach ($variables['tips'] as $name => $tiplist) { - foreach ($tiplist as $tip_key => $tip) { - $tiplist[$tip_key]['attributes'] = new Attribute(); + foreach ($variables['tips'] as $name => $tip_list) { + foreach ($tip_list as $tip_key => $tip) { + $tip_list[$tip_key]['attributes'] = new Attribute(); } $variables['tips'][$name] = [ 'attributes' => new Attribute(), 'name' => $name, - 'list' => $tiplist, + 'list' => $tip_list, ]; } @@ -709,7 +709,7 @@ function _filter_autop($text) { // Note: PHP ensures the array consists of alternating delimiters and literals // and begins and ends with a literal (inserting NULL as required). $ignore = FALSE; - $ignoretag = ''; + $ignore_tag = ''; $output = ''; foreach ($chunks as $i => $chunk) { if ($i % 2) { @@ -725,13 +725,13 @@ function _filter_autop($text) { if (!$ignore) { if ($open) { $ignore = TRUE; - $ignoretag = $tag; + $ignore_tag = $tag; } } // Only allow a matching tag to close it. - elseif (!$open && $ignoretag == $tag) { + elseif (!$open && $ignore_tag == $tag) { $ignore = FALSE; - $ignoretag = ''; + $ignore_tag = ''; } } elseif (!$ignore) { diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 3e5f6a183a70..c545bf3d9f57 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -1185,8 +1185,8 @@ function _locale_invalidate_js($langcode = NULL) { if (empty($langcode)) { // Invalidate all languages. $languages = locale_translatable_language_list(); - foreach ($languages as $lcode => $data) { - $parsed['refresh:' . $lcode] = 'waiting'; + foreach ($languages as $language_code => $data) { + $parsed['refresh:' . $language_code] = 'waiting'; } } else { diff --git a/core/modules/locale/src/Form/TranslateEditForm.php b/core/modules/locale/src/Form/TranslateEditForm.php index 18b8f834b357..a377103c27cf 100644 --- a/core/modules/locale/src/Form/TranslateEditForm.php +++ b/core/modules/locale/src/Form/TranslateEditForm.php @@ -31,7 +31,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $this->languageManager->reset(); $languages = $this->languageManager->getLanguages(); - $langname = isset($langcode) ? $languages[$langcode]->getName() : "- None -"; + $language_name = isset($langcode) ? $languages[$langcode]->getName() : "- None -"; $form['#attached']['library'][] = 'locale/drupal.locale.admin'; @@ -43,10 +43,10 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['strings'] = [ '#type' => 'table', '#tree' => TRUE, - '#language' => $langname, + '#language' => $language_name, '#header' => [ $this->t('Source string'), - $this->t('Translation for @language', ['@language' => $langname]), + $this->t('Translation for @language', ['@language' => $language_name]), ], '#empty' => $this->t('No strings available.'), '#attributes' => ['class' => ['locale-translate-edit-table']], @@ -113,7 +113,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { if (!$plural) { $form['strings'][$string->lid]['translations'][0] = [ '#type' => 'textarea', - '#title' => $this->t('Translated string (@language)', ['@language' => $langname]), + '#title' => $this->t('Translated string (@language)', ['@language' => $language_name]), '#title_display' => 'invisible', '#rows' => $rows, '#default_value' => $translation_array[0], @@ -130,7 +130,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#rows' => $rows, '#default_value' => $translation_array[$i] ?? '', '#attributes' => ['lang' => $langcode], - '#prefix' => $i == 0 ? ('<span class="visually-hidden">' . $this->t('Translated string (@language)', ['@language' => $langname]) . '</span>') : '', + '#prefix' => $i == 0 ? ('<span class="visually-hidden">' . $this->t('Translated string (@language)', ['@language' => $language_name]) . '</span>') : '', ]; } if ($plurals == 2) { diff --git a/core/modules/media/src/Form/EditorMediaDialog.php b/core/modules/media/src/Form/EditorMediaDialog.php index 7195f48e3d35..9c0ae491cdea 100644 --- a/core/modules/media/src/Form/EditorMediaDialog.php +++ b/core/modules/media/src/Form/EditorMediaDialog.php @@ -203,12 +203,12 @@ public function buildForm(array $form, FormStateInterface $form_state, EditorInt $warning = $this->t('There is nothing to configure for this media.'); $form['no_access_notice'] = ['#markup' => $warning]; if ($format->access('update')) { - $tparams = [ + $arguments = [ '@warning' => $warning, '@edit_url' => $format->toUrl('edit-form')->toString(), '%format' => $format->label(), ]; - $form['no_access_notice']['#markup'] = $this->t('@warning <a href="@edit_url">Edit the text format %format</a> to modify the attributes that can be overridden.', $tparams); + $form['no_access_notice']['#markup'] = $this->t('@warning <a href="@edit_url">Edit the text format %format</a> to modify the attributes that can be overridden.', $arguments); } } diff --git a/core/modules/mysql/src/Driver/Database/mysql/Schema.php b/core/modules/mysql/src/Driver/Database/mysql/Schema.php index d0076f3481e0..199acc914138 100644 --- a/core/modules/mysql/src/Driver/Database/mysql/Schema.php +++ b/core/modules/mysql/src/Driver/Database/mysql/Schema.php @@ -409,9 +409,9 @@ public function addField($table, $field, $spec, $keys_new = []) { $this->ensureNotNullPrimaryKey($keys_new['primary key'], [$field => $spec]); } - $fixnull = FALSE; + $fix_null = FALSE; if (!empty($spec['not null']) && !isset($spec['default']) && !$is_primary_key) { - $fixnull = TRUE; + $fix_null = TRUE; $spec['not null'] = FALSE; } $query = 'ALTER TABLE {' . $table . '} ADD '; @@ -445,7 +445,7 @@ public function addField($table, $field, $spec, $keys_new = []) { ->fields([$field => $spec['initial']]) ->execute(); } - if ($fixnull) { + if ($fix_null) { $spec['not null'] = TRUE; $this->changeField($table, $field, $field, $spec); } diff --git a/core/modules/node/src/Controller/NodeController.php b/core/modules/node/src/Controller/NodeController.php index 92fc83b200af..25965374a72d 100644 --- a/core/modules/node/src/Controller/NodeController.php +++ b/core/modules/node/src/Controller/NodeController.php @@ -155,12 +155,12 @@ public function revisionPageTitle(NodeInterface $node_revision) { */ public function revisionOverview(NodeInterface $node) { $langcode = $node->language()->getId(); - $langname = $node->language()->getName(); + $language_name = $node->language()->getName(); $languages = $node->getTranslationLanguages(); $has_translations = (count($languages) > 1); $node_storage = $this->entityTypeManager()->getStorage('node'); - $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $node->label()]) : $this->t('Revisions for %title', ['%title' => $node->label()]); + $build['#title'] = $has_translations ? $this->t('@language_name revisions for %title', ['@language_name' => $language_name, '%title' => $node->label()]) : $this->t('Revisions for %title', ['%title' => $node->label()]); $header = [$this->t('Revision'), $this->t('Operations')]; $rows = []; diff --git a/core/modules/node/src/NodeGrantDatabaseStorage.php b/core/modules/node/src/NodeGrantDatabaseStorage.php index 7d5b2a348b59..a8289edb7edf 100644 --- a/core/modules/node/src/NodeGrantDatabaseStorage.php +++ b/core/modules/node/src/NodeGrantDatabaseStorage.php @@ -161,7 +161,7 @@ public function alterQuery($query, array $tables, $operation, AccountInterface $ $grants_exist = count($grant_conditions->conditions()) > 0; $is_multilingual = \Drupal::languageManager()->isMultilingual(); - foreach ($tables as $nalias => $tableinfo) { + foreach ($tables as $table_alias => $tableinfo) { $table = $tableinfo['table']; if (!($table instanceof SelectInterface) && $table == $base_table) { // Set the subquery. @@ -189,7 +189,7 @@ public function alterQuery($query, array $tables, $operation, AccountInterface $ $field = 'nid'; // Now handle entities. - $subquery->where("[$nalias].[$field] = [na].[nid]"); + $subquery->where("[$table_alias].[$field] = [na].[nid]"); $query->exists($subquery); } diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php index a7a389a67f9a..62515e8caff6 100644 --- a/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php +++ b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php @@ -646,9 +646,9 @@ public function addField($table, $field, $spec, $new_keys = []) { $this->ensureNotNullPrimaryKey($new_keys['primary key'], [$field => $spec]); } - $fixnull = FALSE; + $fix_null = FALSE; if (!empty($spec['not null']) && !isset($spec['default']) && !$is_primary_key) { - $fixnull = TRUE; + $fix_null = TRUE; $spec['not null'] = FALSE; } $query = 'ALTER TABLE {' . $table . '} ADD COLUMN '; @@ -672,7 +672,7 @@ public function addField($table, $field, $spec, $new_keys = []) { ->fields([$field => $spec['initial']]) ->execute(); } - if ($fixnull) { + if ($fix_null) { $this->connection->query("ALTER TABLE {" . $table . "} ALTER $field SET NOT NULL"); } if (isset($new_keys)) { diff --git a/core/modules/search/src/SearchIndex.php b/core/modules/search/src/SearchIndex.php index 583ffd2e889f..97f57abe129a 100644 --- a/core/modules/search/src/SearchIndex.php +++ b/core/modules/search/src/SearchIndex.php @@ -99,11 +99,11 @@ public function index($type, $sid, $langcode, $text, $update_weights = TRUE) { // Starting score per word. $score = 1; // Accumulator for cleaned up data. - $accum = ' '; + $accumulator = ' '; // Stack with open tags. - $tagstack = []; + $tag_stack = []; // Counter for consecutive words. - $tagwords = 0; + $tag_words = 0; // Focus state. $focus = 1; @@ -120,30 +120,30 @@ public function index($type, $sid, $langcode, $text, $update_weights = TRUE) { $tagname = substr($tagname, 1); // If we encounter unexpected tags, reset score to avoid incorrect // boosting. - if (!count($tagstack) || $tagstack[0] != $tagname) { - $tagstack = []; + if (!count($tag_stack) || $tag_stack[0] != $tagname) { + $tag_stack = []; $score = 1; } else { // Remove from tag stack and decrement score. - $score = max(1, $score - $tags[array_shift($tagstack)]); + $score = max(1, $score - $tags[array_shift($tag_stack)]); } } else { - if (isset($tagstack[0]) && $tagstack[0] == $tagname) { + if (isset($tag_stack[0]) && $tag_stack[0] == $tagname) { // None of the tags we look for make sense when nested identically. // If they are, it's probably broken HTML. - $tagstack = []; + $tag_stack = []; $score = 1; } else { // Add to open tag stack and increment score. - array_unshift($tagstack, $tagname); + array_unshift($tag_stack, $tagname); $score += $tags[$tagname]; } } // A tag change occurred, reset counter. - $tagwords = 0; + $tag_words = 0; } else { // Note: use of PREG_SPLIT_DELIM_CAPTURE above will introduce empty @@ -152,7 +152,7 @@ public function index($type, $sid, $langcode, $text, $update_weights = TRUE) { $words = $this->textProcessor->process($value, $langcode); foreach ($words as $word) { // Add word to accumulator. - $accum .= $word . ' '; + $accumulator .= $word . ' '; // Check word length. if (is_numeric($word) || mb_strlen($word) >= $minimum_word_size) { if (!isset($scored_words[$word])) { @@ -164,11 +164,11 @@ public function index($type, $sid, $langcode, $text, $update_weights = TRUE) { // e.g. 0.5 at 500 words and 0.3 at 1000 words. $focus = min(1, .01 + 3.5 / (2 + count($scored_words) * .015)); } - $tagwords++; + $tag_words++; // Too many words inside a single tag probably mean a tag was // accidentally left open. - if (count($tagstack) && $tagwords >= 15) { - $tagstack = []; + if (count($tag_stack) && $tag_words >= 15) { + $tag_stack = []; $score = 1; } } @@ -188,7 +188,7 @@ public function index($type, $sid, $langcode, $text, $update_weights = TRUE) { 'sid' => $sid, 'langcode' => $langcode, 'type' => $type, - 'data' => $accum, + 'data' => $accumulator, 'reindex' => 0, ]) ->execute(); diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php index 73817872e344..d7816dac3de4 100644 --- a/core/modules/search/src/SearchQuery.php +++ b/core/modules/search/src/SearchQuery.php @@ -314,14 +314,14 @@ protected function parseSearchExpression() { } $has_or = TRUE; $has_new_scores = FALSE; - $queryor = $this->connection->condition('OR'); + $query_or = $this->connection->condition('OR'); foreach ($key as $or) { [$num_new_scores] = $this->parseWord($or); $has_new_scores |= $num_new_scores; - $queryor->condition('d.data', "% $or %", 'LIKE'); + $query_or->condition('d.data', "% $or %", 'LIKE'); } - if (count($queryor)) { - $this->conditions->condition($queryor); + if (count($query_or)) { + $this->conditions->condition($query_or); // A group of OR keywords only needs to match once. $this->matches += ($has_new_scores > 0); } diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php index eaa203077528..4e7b1f9c168d 100644 --- a/core/modules/taxonomy/src/Form/OverviewTerms.php +++ b/core/modules/taxonomy/src/Form/OverviewTerms.php @@ -182,10 +182,10 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular $term = $tree[$tree_index]; if (isset($term->depth) && ($term->depth > 0) && !isset($back_step)) { $back_step = 0; - while ($pterm = $tree[--$tree_index]) { + while ($parent_term = $tree[--$tree_index]) { $before_entries--; $back_step++; - if ($pterm->depth == 0) { + if ($parent_term->depth == 0) { $tree_index--; // Jump back to the start of the root level parent. continue 2; diff --git a/core/modules/text/text.module b/core/modules/text/text.module index c0a03c62f978..1d980d7e25e9 100644 --- a/core/modules/text/text.module +++ b/core/modules/text/text.module @@ -104,12 +104,12 @@ function text_summary($text, $format = NULL, $size = NULL) { // Store the actual length of the UTF8 string -- which might not be the same // as $size. - $max_rpos = strlen($summary); + $max_right_pos = strlen($summary); // How much to cut off the end of the summary so that it doesn't end in the // middle of a paragraph, sentence, or word. // Initialize it to maximum in order to find the minimum. - $min_rpos = $max_rpos; + $min_right_pos = $max_right_pos; // Store the reverse of the summary. We use strpos on the reversed needle and // haystack for speed and convenience. @@ -138,16 +138,16 @@ function text_summary($text, $format = NULL, $size = NULL) { // Look for each break point, starting at the end of the summary. foreach ($points as $point => $offset) { // The summary is already reversed, but the break point isn't. - $rpos = strpos($reversed, strrev($point)); - if ($rpos !== FALSE) { - $min_rpos = min($rpos + $offset, $min_rpos); + $right_pos = strpos($reversed, strrev($point)); + if ($right_pos !== FALSE) { + $min_right_pos = min($right_pos + $offset, $min_right_pos); } } // If a break point was found in this group, slice and stop searching. - if ($min_rpos !== $max_rpos) { + if ($min_right_pos !== $max_right_pos) { // Don't slice with length 0. Length must be <0 to slice from RHS. - $summary = ($min_rpos === 0) ? $summary : substr($summary, 0, 0 - $min_rpos); + $summary = ($min_right_pos === 0) ? $summary : substr($summary, 0, 0 - $min_right_pos); break; } } diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 76190f7cafe4..e85228a5d045 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -818,7 +818,7 @@ function user_mail_tokens(&$replacements, $data, $options) { /** * Retrieves the names of roles matching specified conditions. * - * @param bool $membersonly + * @param bool $members_only * (optional) Set this to TRUE to exclude the 'anonymous' role. Defaults to * FALSE. * @param string|null $permission @@ -836,11 +836,11 @@ function user_mail_tokens(&$replacements, $data, $options) { * * @see https://www.drupal.org/node/3349759 */ -function user_role_names($membersonly = FALSE, $permission = NULL) { +function user_role_names($members_only = FALSE, $permission = NULL) { @trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead. See https://www.drupal.org/node/3349759', E_USER_DEPRECATED); return array_map(function ($item) { return $item->label(); - }, user_roles($membersonly, $permission)); + }, user_roles($members_only, $permission)); } /** @@ -907,7 +907,7 @@ function user_user_role_delete(RoleInterface $role) { /** * Retrieve an array of roles matching specified conditions. * - * @param bool $membersonly + * @param bool $members_only * (optional) Set this to TRUE to exclude the 'anonymous' role. Defaults to * FALSE. * @param string|null $permission @@ -925,10 +925,10 @@ function user_user_role_delete(RoleInterface $role) { * * @see https://www.drupal.org/node/3349759 */ -function user_roles($membersonly = FALSE, $permission = NULL) { +function user_roles($members_only = FALSE, $permission = NULL) { @trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead. See https://www.drupal.org/node/3349759', E_USER_DEPRECATED); $roles = Role::loadMultiple(); - if ($membersonly) { + if ($members_only) { unset($roles[RoleInterface::ANONYMOUS_ID]); } diff --git a/core/scripts/generate-d6-content.sh b/core/scripts/generate-d6-content.sh index fc4c68f96c7d..5305d49ff370 100644 --- a/core/scripts/generate-d6-content.sh +++ b/core/scripts/generate-d6-content.sh @@ -167,8 +167,8 @@ $node->created = $now + $i * 43200; $node->log = "added $i poll"; - $nbchoices = ($i % 4) + 2; - for ($c = 0; $c < $nbchoices; $c++) { + $number_of_choices = ($i % 4) + 2; + for ($c = 0; $c < $number_of_choices; $c++) { $node->choice[] = array('chtext' => "Choice $c for poll $i"); } node_save($node); @@ -177,7 +177,7 @@ // Add some votes for ($v = 0; $v < ($i % 4) + 5; $v++) { - $c = $v % $nbchoices; + $c = $v % $number_of_choices; $form_state = array(); $form_state['values']['choice'] = $c; $form_state['values']['op'] = t('Vote'); diff --git a/core/scripts/generate-d7-content.sh b/core/scripts/generate-d7-content.sh index c7547b084243..037408925a77 100644 --- a/core/scripts/generate-d7-content.sh +++ b/core/scripts/generate-d7-content.sh @@ -243,8 +243,8 @@ $node->log = "added $i poll"; $node->path = array('alias' => "content/poll/$i"); - $nbchoices = ($i % 4) + 2; - for ($c = 0; $c < $nbchoices; $c++) { + $number_of_choices = ($i % 4) + 2; + for ($c = 0; $c < $number_of_choices; $c++) { $node->choice[] = array('chtext' => "Choice $c for poll $i", 'chvotes' => 0, 'weight' => 0); } node_save($node); @@ -262,7 +262,7 @@ drupal_static_reset('ip_address'); $_SERVER['REMOTE_ADDR'] = "127.0.$v.1"; $GLOBALS['user'] = drupal_anonymous_user();// We should have already allowed anon to vote. - $c = $v % $nbchoices; + $c = $v % $number_of_choices; $form_state = array(); $form_state['values']['choice'] = $choices[$c]; $form_state['values']['op'] = t('Vote'); -- GitLab