From ca9af3d9b2e194414454ec93f1c768f6e67be186 Mon Sep 17 00:00:00 2001
From: Dave Long <dave@longwaveconsulting.com>
Date: Sun, 3 Dec 2023 22:01:59 +0000
Subject: [PATCH] Issue #3392439 by quietone: Fix variable name spelling in
 non-tests, part2

---
 core/includes/install.inc                     |  8 ++--
 .../Annotation/Doctrine/DocParser.php         |  4 +-
 .../Doctrine/SimpleAnnotationReader.php       | 18 ++++-----
 .../Component/Datetime/DateTimePlus.php       | 10 ++---
 .../lib/Drupal/Component/Gettext/PoHeader.php | 38 +++++++++----------
 .../Component/Gettext/PoStreamReader.php      |  4 +-
 .../Drupal/Component/Utility/UrlHelper.php    | 14 +++----
 core/misc/cspell/dictionary.txt               |  6 ---
 8 files changed, 48 insertions(+), 54 deletions(-)

diff --git a/core/includes/install.inc b/core/includes/install.inc
index 1bf8c485c039..083776a53770 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -574,14 +574,14 @@ function drupal_install_system($install_state) {
  *   An optional bitmask created from various FILE_* constants.
  * @param $type
  *   The type of file. Can be file (default), dir, or link.
- * @param bool $autofix
+ * @param bool $auto_fix
  *   (optional) Determines whether to attempt fixing the permissions according
  *   to the provided $mask. Defaults to TRUE.
  *
  * @return bool
  *   TRUE on success or FALSE on failure. A message is set for the latter.
  */
-function drupal_verify_install_file($file, $mask = NULL, $type = 'file', $autofix = TRUE) {
+function drupal_verify_install_file($file, $mask = NULL, $type = 'file', $auto_fix = TRUE) {
   $return = TRUE;
   // Check for files that shouldn't be there.
   if (isset($mask) && ($mask & FILE_NOT_EXIST) && file_exists($file)) {
@@ -603,7 +603,7 @@ function drupal_verify_install_file($file, $mask = NULL, $type = 'file', $autofi
         switch ($current_mask) {
           case FILE_EXIST:
             if (!file_exists($file)) {
-              if ($type == 'dir' && $autofix) {
+              if ($type == 'dir' && $auto_fix) {
                 drupal_install_mkdir($file, $mask);
               }
               if (!file_exists($file)) {
@@ -651,7 +651,7 @@ function drupal_verify_install_file($file, $mask = NULL, $type = 'file', $autofi
       }
     }
   }
-  if (!$return && $autofix) {
+  if (!$return && $auto_fix) {
     return drupal_install_fix_file($file, $mask);
   }
   return $return;
diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php b/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php
index 4070674cfb21..960c4869ff87 100644
--- a/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php
+++ b/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php
@@ -637,8 +637,8 @@ private function Annotations()
             }
 
             $this->isNestedAnnotation = false;
-            if (false !== $annot = $this->Annotation()) {
-                $annotations[] = $annot;
+            if (false !== $annotation = $this->Annotation()) {
+                $annotations[] = $annotation;
             }
         }
 
diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/SimpleAnnotationReader.php b/core/lib/Drupal/Component/Annotation/Doctrine/SimpleAnnotationReader.php
index 96e6b8dff158..185fc622fdb5 100644
--- a/core/lib/Drupal/Component/Annotation/Doctrine/SimpleAnnotationReader.php
+++ b/core/lib/Drupal/Component/Annotation/Doctrine/SimpleAnnotationReader.php
@@ -122,9 +122,9 @@ public function getPropertyAnnotations(\ReflectionProperty $property)
      */
     public function getClassAnnotation(\ReflectionClass $class, $annotationName)
     {
-        foreach ($this->getClassAnnotations($class) as $annot) {
-            if ($annot instanceof $annotationName) {
-                return $annot;
+        foreach ($this->getClassAnnotations($class) as $annotation) {
+            if ($annotation instanceof $annotationName) {
+                return $annotation;
             }
         }
 
@@ -136,9 +136,9 @@ public function getClassAnnotation(\ReflectionClass $class, $annotationName)
      */
     public function getMethodAnnotation(\ReflectionMethod $method, $annotationName)
     {
-        foreach ($this->getMethodAnnotations($method) as $annot) {
-            if ($annot instanceof $annotationName) {
-                return $annot;
+        foreach ($this->getMethodAnnotations($method) as $annotation) {
+            if ($annotation instanceof $annotationName) {
+                return $annotation;
             }
         }
 
@@ -150,9 +150,9 @@ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName)
      */
     public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName)
     {
-        foreach ($this->getPropertyAnnotations($property) as $annot) {
-            if ($annot instanceof $annotationName) {
-                return $annot;
+        foreach ($this->getPropertyAnnotations($property) as $annotation) {
+            if ($annotation instanceof $annotationName) {
+                return $annotation;
             }
         }
 
diff --git a/core/lib/Drupal/Component/Datetime/DateTimePlus.php b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
index 44d27d89598d..6213275ed89d 100644
--- a/core/lib/Drupal/Component/Datetime/DateTimePlus.php
+++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
@@ -246,15 +246,15 @@ public static function createFromFormat($format, $time, $timezone = NULL, $setti
     // Tries to create a date from the format and use it if possible.
     // A regular try/catch won't work right here, if the value is
     // invalid it doesn't return an exception.
-    $datetimeplus = new static('', $timezone, $settings);
+    $datetime_plus = new static('', $timezone, $settings);
 
-    $date = \DateTime::createFromFormat($format, $time, $datetimeplus->getTimezone());
+    $date = \DateTime::createFromFormat($format, $time, $datetime_plus->getTimezone());
     if (!$date instanceof \DateTime) {
       throw new \InvalidArgumentException('The date cannot be created from a format.');
     }
     else {
-      $datetimeplus->setTimestamp($date->getTimestamp());
-      $datetimeplus->setTimezone($date->getTimezone());
+      $datetime_plus->setTimestamp($date->getTimestamp());
+      $datetime_plus->setTimezone($date->getTimezone());
 
       // Functions that parse date is forgiving, it might create a date that
       // is not exactly a match for the provided value, so test for that by
@@ -265,7 +265,7 @@ public static function createFromFormat($format, $time, $timezone = NULL, $setti
         throw new \UnexpectedValueException('The created date does not match the input value.');
       }
     }
-    return $datetimeplus;
+    return $datetime_plus;
   }
 
   /**
diff --git a/core/lib/Drupal/Component/Gettext/PoHeader.php b/core/lib/Drupal/Component/Gettext/PoHeader.php
index a54377aa53c5..0449ba6f6b81 100644
--- a/core/lib/Drupal/Component/Gettext/PoHeader.php
+++ b/core/lib/Drupal/Component/Gettext/PoHeader.php
@@ -180,7 +180,7 @@ public function __toString() {
   /**
    * Parses a Plural-Forms entry from a Gettext Portable Object file header.
    *
-   * @param string $pluralforms
+   * @param string $plural_forms
    *   The Plural-Forms entry value.
    *
    * @return array|bool
@@ -191,13 +191,13 @@ public function __toString() {
    *
    * @throws \Exception
    */
-  public function parsePluralForms($pluralforms) {
+  public function parsePluralForms($plural_forms) {
     $plurals = [];
     // First, delete all whitespace.
-    $pluralforms = strtr($pluralforms, [" " => "", "\t" => ""]);
+    $plural_forms = strtr($plural_forms, [" " => "", "\t" => ""]);
 
     // Select the parts that define nplurals and plural.
-    $nplurals = strstr($pluralforms, "nplurals=");
+    $nplurals = strstr($plural_forms, "nplurals=");
     if (strpos($nplurals, ";")) {
       // We want the string from the 10th char, because "nplurals=" length is 9.
       $nplurals = substr($nplurals, 9, strpos($nplurals, ";") - 9);
@@ -205,7 +205,7 @@ public function parsePluralForms($pluralforms) {
     else {
       return FALSE;
     }
-    $plural = strstr($pluralforms, "plural=");
+    $plural = strstr($plural_forms, "plural=");
     if (strpos($plural, ";")) {
       // We want the string from the 8th char, because "plural=" length is 7.
       $plural = substr($plural, 7, strpos($plural, ";") - 7);
@@ -303,24 +303,24 @@ private function parseArithmetic($string) {
         $operator_stack[] = $current_token;
       }
       elseif ($current_token == ")") {
-        $topop = array_pop($operator_stack);
-        while (isset($topop) && ($topop != "(")) {
-          $element_stack[] = $topop;
-          $topop = array_pop($operator_stack);
+        $top_op = array_pop($operator_stack);
+        while (isset($top_op) && ($top_op != "(")) {
+          $element_stack[] = $top_op;
+          $top_op = array_pop($operator_stack);
         }
       }
       elseif (!empty($precedence[$current_token])) {
         // If it's an operator, then pop from $operator_stack into
         // $element_stack until the precedence in $operator_stack is less
         // than current, then push into $operator_stack.
-        $topop = array_pop($operator_stack);
-        while (isset($topop) && ($precedence[$topop] >= $precedence[$current_token]) && !(($precedence[$topop] == $precedence[$current_token]) && !empty($right_associativity[$topop]) && !empty($right_associativity[$current_token]))) {
-          $element_stack[] = $topop;
-          $topop = array_pop($operator_stack);
+        $top_op = array_pop($operator_stack);
+        while (isset($top_op) && ($precedence[$top_op] >= $precedence[$current_token]) && !(($precedence[$top_op] == $precedence[$current_token]) && !empty($right_associativity[$top_op]) && !empty($right_associativity[$current_token]))) {
+          $element_stack[] = $top_op;
+          $top_op = array_pop($operator_stack);
         }
-        if ($topop) {
+        if ($top_op) {
           // Return element to top.
-          $operator_stack[] = $topop;
+          $operator_stack[] = $top_op;
         }
         // Parentheses are not needed.
         $operator_stack[] = $current_token;
@@ -331,10 +331,10 @@ private function parseArithmetic($string) {
     }
 
     // Flush operator stack.
-    $topop = array_pop($operator_stack);
-    while ($topop != NULL) {
-      $element_stack[] = $topop;
-      $topop = array_pop($operator_stack);
+    $top_op = array_pop($operator_stack);
+    while ($top_op != NULL) {
+      $element_stack[] = $top_op;
+      $top_op = array_pop($operator_stack);
     }
     $return = $element_stack;
 
diff --git a/core/lib/Drupal/Component/Gettext/PoStreamReader.php b/core/lib/Drupal/Component/Gettext/PoStreamReader.php
index aed4bd9907d9..0644b25e8647 100644
--- a/core/lib/Drupal/Component/Gettext/PoStreamReader.php
+++ b/core/lib/Drupal/Component/Gettext/PoStreamReader.php
@@ -407,8 +407,8 @@ private function readLine() {
         }
 
         // Extract the plurality.
-        $frombracket = strstr($line, '[');
-        $this->currentPluralIndex = substr($frombracket, 1, strpos($frombracket, ']') - 1);
+        $from_bracket = strstr($line, '[');
+        $this->currentPluralIndex = substr($from_bracket, 1, strpos($from_bracket, ']') - 1);
 
         // Skip to the next whitespace and trim away any further whitespace,
         // bringing $line to the message text only.
diff --git a/core/lib/Drupal/Component/Utility/UrlHelper.php b/core/lib/Drupal/Component/Utility/UrlHelper.php
index c78a27450ee5..6b1f3ab12f3f 100644
--- a/core/lib/Drupal/Component/Utility/UrlHelper.php
+++ b/core/lib/Drupal/Component/Utility/UrlHelper.php
@@ -254,7 +254,7 @@ public static function encodePath($path) {
    *   TRUE or FALSE, where TRUE indicates an external path.
    */
   public static function isExternal($path) {
-    $colonpos = strpos($path, ':');
+    $colon_position = strpos($path, ':');
     // Some browsers treat \ as / so normalize to forward slashes.
     $path = str_replace('\\', '/', $path);
     // If the path starts with 2 slashes then it is always considered an
@@ -268,8 +268,8 @@ public static function isExternal($path) {
       // Avoid calling static::stripDangerousProtocols() if there is any slash
       // (/), hash (#) or question_mark (?) before the colon (:) occurrence -
       // if any - as this would clearly mean it is not a URL.
-      || ($colonpos !== FALSE
-        && !preg_match('![/?#]!', substr($path, 0, $colonpos))
+      || ($colon_position !== FALSE
+        && !preg_match('![/?#]!', substr($path, 0, $colon_position))
         && static::stripDangerousProtocols($path) == $path);
   }
 
@@ -398,10 +398,10 @@ public static function stripDangerousProtocols($uri) {
     // Iteratively remove any invalid protocol found.
     do {
       $before = $uri;
-      $colonpos = strpos($uri, ':');
-      if ($colonpos > 0) {
+      $colon_position = strpos($uri, ':');
+      if ($colon_position > 0) {
         // We found a colon, possibly a protocol. Verify.
-        $protocol = substr($uri, 0, $colonpos);
+        $protocol = substr($uri, 0, $colon_position);
         // If a colon is preceded by a slash, question mark or hash, it cannot
         // possibly be part of the URL scheme. This must be a relative URL, which
         // inherits the (safe) protocol of the base document.
@@ -411,7 +411,7 @@ public static function stripDangerousProtocols($uri) {
         // Check if this is a disallowed protocol. Per RFC2616, section 3.2.3
         // (URI Comparison) scheme comparison must be case-insensitive.
         if (!isset($allowed_protocols[strtolower($protocol)])) {
-          $uri = substr($uri, $colonpos + 1);
+          $uri = substr($uri, $colon_position + 1);
         }
       }
     } while ($before != $uri);
diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt
index 863fd299e5b7..596773c4ef0f 100644
--- a/core/misc/cspell/dictionary.txt
+++ b/core/misc/cspell/dictionary.txt
@@ -16,7 +16,6 @@ alphadecimal
 alternatif
 amphibius
 ampm
-annot
 anonyme
 anothermodule
 antilop
@@ -47,7 +46,6 @@ autocreation
 autoescape
 autoescaped
 autoescaping
-autofix
 autogenerator
 autoloadable
 autoloaded
@@ -165,7 +163,6 @@ cnenzrgre
 codesniffer
 colgroups
 colinodell
-colonpos
 colour
 colspans
 columnschange
@@ -356,7 +353,6 @@ fouc
 fourcol
 fozzie
 fraîche
-frombracket
 frontpage
 fudgy
 fulldata
@@ -645,7 +641,6 @@ placeholdered
 placeholdering
 plid
 pluggable
-pluralforms
 plusthick
 poink
 porterstemmer
@@ -941,7 +936,6 @@ tongatapu
 toolkits
 toolongdomainexampledomainexampledomainexampledomainexampledomain
 toplevel
-topop
 torder
 totalcount
 touchevents
-- 
GitLab