Passed
Push — master ( 2e9f0d...d736a2 )
by Lars
12:39 queued 02:47
created
src/voku/helper/UTF8.php 1 patch
Spacing   +120 added lines, -121 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
   public static function add_bom_to_string(string $str): string
265 265
   {
266 266
     if (self::string_has_bom($str) === false) {
267
-      $str = self::bom() . $str;
267
+      $str = self::bom().$str;
268 268
     }
269 269
 
270 270
     return $str;
@@ -531,10 +531,10 @@  discard block
 block discarded – undo
531 531
         &&
532 532
         self::$SUPPORT['mbstring'] === false
533 533
     ) {
534
-      \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
534
+      \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
535 535
     }
536 536
 
537
-    $cacheKey = $code_point . $encoding;
537
+    $cacheKey = $code_point.$encoding;
538 538
     if (isset($CHAR_CACHE[$cacheKey]) === true) {
539 539
       return $CHAR_CACHE[$cacheKey];
540 540
     }
@@ -579,16 +579,16 @@  discard block
 block discarded – undo
579 579
     if ($code_point <= 0x7F) {
580 580
       $chr = self::$CHR[$code_point];
581 581
     } elseif ($code_point <= 0x7FF) {
582
-      $chr = self::$CHR[($code_point >> 6) + 0xC0] .
582
+      $chr = self::$CHR[($code_point >> 6) + 0xC0].
583 583
              self::$CHR[($code_point & 0x3F) + 0x80];
584 584
     } elseif ($code_point <= 0xFFFF) {
585
-      $chr = self::$CHR[($code_point >> 12) + 0xE0] .
586
-             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] .
585
+      $chr = self::$CHR[($code_point >> 12) + 0xE0].
586
+             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80].
587 587
              self::$CHR[($code_point & 0x3F) + 0x80];
588 588
     } else {
589
-      $chr = self::$CHR[($code_point >> 18) + 0xF0] .
590
-             self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] .
591
-             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] .
589
+      $chr = self::$CHR[($code_point >> 18) + 0xF0].
590
+             self::$CHR[(($code_point >> 12) & 0x3F) + 0x80].
591
+             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80].
592 592
              self::$CHR[($code_point & 0x3F) + 0x80];
593 593
     }
594 594
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
     if (self::$SUPPORT['mbstring_func_overload'] === true) {
642 642
       return \array_map(
643
-          function ($data) {
643
+          function($data) {
644 644
             return UTF8::strlen_in_byte($data);
645 645
           },
646 646
           $strSplit
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
    */
956 956
   public static function decimal_to_chr($int): string
957 957
   {
958
-    return self::html_entity_decode('&#' . $int . ';', ENT_QUOTES | ENT_HTML5);
958
+    return self::html_entity_decode('&#'.$int.';', ENT_QUOTES | ENT_HTML5);
959 959
   }
960 960
 
961 961
   /**
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
         &&
1115 1115
         self::$SUPPORT['mbstring'] === false
1116 1116
     ) {
1117
-      \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', E_USER_WARNING);
1117
+      \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', E_USER_WARNING);
1118 1118
     }
1119 1119
 
1120 1120
     if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
       }
1135 1135
     }
1136 1136
 
1137
-    $return = \iconv($fromEncoding, $toEncoding . '//IGNORE', $str);
1137
+    $return = \iconv($fromEncoding, $toEncoding.'//IGNORE', $str);
1138 1138
     if ($return !== false) {
1139 1139
       return $return;
1140 1140
     }
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
           return '';
1231 1231
         }
1232 1232
 
1233
-        return \rtrim($strSub, $trimChars) . $replacerForSkippedText;
1233
+        return \rtrim($strSub, $trimChars).$replacerForSkippedText;
1234 1234
       }
1235 1235
 
1236 1236
       return $str;
@@ -1266,14 +1266,14 @@  discard block
 block discarded – undo
1266 1266
       if (!$pos_end || $pos_end <= 0) {
1267 1267
         $strSub = self::substr($str, $pos_start, self::strlen($str), $encoding);
1268 1268
         if ($strSub !== false) {
1269
-          $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars);
1269
+          $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars);
1270 1270
         } else {
1271 1271
           $extract = '';
1272 1272
         }
1273 1273
       } else {
1274 1274
         $strSub = self::substr($str, $pos_start, $pos_end, $encoding);
1275 1275
         if ($strSub !== false) {
1276
-          $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText;
1276
+          $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText;
1277 1277
         } else {
1278 1278
           $extract = '';
1279 1279
         }
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
       if ($pos_end) {
1297 1297
         $strSub = self::substr($str, 0, $pos_end, $encoding);
1298 1298
         if ($strSub !== false) {
1299
-          $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText;
1299
+          $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText;
1300 1300
         } else {
1301 1301
           $extract = '';
1302 1302
         }
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
   {
1419 1419
     $file_content = \file_get_contents($file_path);
1420 1420
     if ($file_content === false) {
1421
-      throw new \RuntimeException('file_get_contents() returned false for:' . $file_path);
1421
+      throw new \RuntimeException('file_get_contents() returned false for:'.$file_path);
1422 1422
     }
1423 1423
 
1424 1424
     return self::string_has_bom($file_content);
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
           ) {
1479 1479
             // Prevent leading combining chars
1480 1480
             // for NFC-safe concatenations.
1481
-            $var = $leading_combining . $var;
1481
+            $var = $leading_combining.$var;
1482 1482
           }
1483 1483
         }
1484 1484
 
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
    */
1974 1974
   private static function getData(string $file)
1975 1975
   {
1976
-    $file = __DIR__ . '/data/' . $file . '.php';
1976
+    $file = __DIR__.'/data/'.$file.'.php';
1977 1977
     if (\file_exists($file)) {
1978 1978
       /** @noinspection PhpIncludeInspection */
1979 1979
       return require $file;
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
     }
2027 2027
 
2028 2028
     $str_info = \unpack('C2chars', $str_info);
2029
-    $type_code = (int)($str_info['chars1'] . $str_info['chars2']);
2029
+    $type_code = (int)($str_info['chars1'].$str_info['chars2']);
2030 2030
 
2031 2031
     // DEBUG
2032 2032
     //var_dump($type_code);
@@ -2119,16 +2119,16 @@  discard block
 block discarded – undo
2119 2119
    */
2120 2120
   public static function get_unique_string($entropyExtra = '', bool $md5 = true): string
2121 2121
   {
2122
-    $uniqueHelper = \mt_rand() .
2123
-                    \session_id() .
2124
-                    ($_SERVER['REMOTE_ADDR'] ?? '') .
2125
-                    ($_SERVER['SERVER_ADDR'] ?? '') .
2122
+    $uniqueHelper = \mt_rand().
2123
+                    \session_id().
2124
+                    ($_SERVER['REMOTE_ADDR'] ?? '').
2125
+                    ($_SERVER['SERVER_ADDR'] ?? '').
2126 2126
                     $entropyExtra;
2127 2127
 
2128 2128
     $uniqueString = \uniqid($uniqueHelper, true);
2129 2129
 
2130 2130
     if ($md5) {
2131
-      $uniqueString = \md5($uniqueString . $uniqueHelper);
2131
+      $uniqueString = \md5($uniqueString.$uniqueHelper);
2132 2132
     }
2133 2133
 
2134 2134
     return $uniqueString;
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
     return \implode(
2274 2274
         '',
2275 2275
         \array_map(
2276
-            function ($chr) use ($keepAsciiChars, $encoding) {
2276
+            function($chr) use ($keepAsciiChars, $encoding) {
2277 2277
               return UTF8::single_chr_html_encode($chr, $keepAsciiChars, $encoding);
2278 2278
             },
2279 2279
             self::split($str)
@@ -2389,7 +2389,7 @@  discard block
 block discarded – undo
2389 2389
         &&
2390 2390
         self::$SUPPORT['mbstring'] === false
2391 2391
     ) {
2392
-      \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
2392
+      \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
2393 2393
     }
2394 2394
 
2395 2395
     if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
@@ -2412,7 +2412,7 @@  discard block
 block discarded – undo
2412 2412
 
2413 2413
         $str = (string)\preg_replace_callback(
2414 2414
             "/&#\d{2,6};/",
2415
-            function ($matches) use ($encoding) {
2415
+            function($matches) use ($encoding) {
2416 2416
               // always fallback via symfony polyfill
2417 2417
               $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES');
2418 2418
 
@@ -2755,9 +2755,9 @@  discard block
 block discarded – undo
2755 2755
   {
2756 2756
     $hex = \dechex($int);
2757 2757
 
2758
-    $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex);
2758
+    $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex);
2759 2759
 
2760
-    return $pfix . $hex . '';
2760
+    return $pfix.$hex.'';
2761 2761
   }
2762 2762
 
2763 2763
   /**
@@ -3694,7 +3694,7 @@  discard block
 block discarded – undo
3694 3694
         $cleanUtf8
3695 3695
     );
3696 3696
 
3697
-    return $strPartOne . $strPartTwo;
3697
+    return $strPartOne.$strPartTwo;
3698 3698
   }
3699 3699
 
3700 3700
   /**
@@ -4177,7 +4177,7 @@  discard block
 block discarded – undo
4177 4177
       }
4178 4178
     }
4179 4179
 
4180
-    $cacheKey = $chr_orig . $encoding;
4180
+    $cacheKey = $chr_orig.$encoding;
4181 4181
     if (isset($CHAR_CACHE[$cacheKey]) === true) {
4182 4182
       return $CHAR_CACHE[$cacheKey];
4183 4183
     }
@@ -4430,7 +4430,7 @@  discard block
 block discarded – undo
4430 4430
     }
4431 4431
 
4432 4432
     $str = (string)\preg_replace(
4433
-        $delimiter . $pattern . $delimiter . 'u' . $options,
4433
+        $delimiter.$pattern.$delimiter.'u'.$options,
4434 4434
         $replacement,
4435 4435
         $str
4436 4436
     );
@@ -4501,7 +4501,7 @@  discard block
 block discarded – undo
4501 4501
     if (\is_array($what) === true) {
4502 4502
       /** @noinspection ForeachSourceInspection */
4503 4503
       foreach ($what as $item) {
4504
-        $str = (string)\preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str);
4504
+        $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str);
4505 4505
       }
4506 4506
     }
4507 4507
 
@@ -4749,7 +4749,7 @@  discard block
 block discarded – undo
4749 4749
   {
4750 4750
     static $RX_CLASSS_CACHE = [];
4751 4751
 
4752
-    $cacheKey = $s . $class;
4752
+    $cacheKey = $s.$class;
4753 4753
 
4754 4754
     if (isset($RX_CLASSS_CACHE[$cacheKey])) {
4755 4755
       return $RX_CLASSS_CACHE[$cacheKey];
@@ -4761,7 +4761,7 @@  discard block
 block discarded – undo
4761 4761
     /** @noinspection SuspiciousLoopInspection */
4762 4762
     foreach (self::str_split($s) as $s) {
4763 4763
       if ('-' === $s) {
4764
-        $class[0] = '-' . $class[0];
4764
+        $class[0] = '-'.$class[0];
4765 4765
       } elseif (!isset($s[2])) {
4766 4766
         $class[0] .= \preg_quote($s, '/');
4767 4767
       } elseif (1 === self::strlen($s)) {
@@ -4772,13 +4772,13 @@  discard block
 block discarded – undo
4772 4772
     }
4773 4773
 
4774 4774
     if ($class[0]) {
4775
-      $class[0] = '[' . $class[0] . ']';
4775
+      $class[0] = '['.$class[0].']';
4776 4776
     }
4777 4777
 
4778 4778
     if (1 === \count($class)) {
4779 4779
       $return = $class[0];
4780 4780
     } else {
4781
-      $return = '(?:' . \implode('|', $class) . ')';
4781
+      $return = '(?:'.\implode('|', $class).')';
4782 4782
     }
4783 4783
 
4784 4784
     $RX_CLASSS_CACHE[$cacheKey] = $return;
@@ -4797,7 +4797,7 @@  discard block
 block discarded – undo
4797 4797
 
4798 4798
     echo '<pre>';
4799 4799
     foreach (self::$SUPPORT as $key => $value) {
4800
-      echo $key . ' - ' . \print_r($value, true) . "\n<br>";
4800
+      echo $key.' - '.\print_r($value, true)."\n<br>";
4801 4801
     }
4802 4802
     echo '</pre>';
4803 4803
   }
@@ -4829,7 +4829,7 @@  discard block
 block discarded – undo
4829 4829
       $encoding = self::normalize_encoding($encoding, 'UTF-8');
4830 4830
     }
4831 4831
 
4832
-    return '&#' . self::ord($char, $encoding) . ';';
4832
+    return '&#'.self::ord($char, $encoding).';';
4833 4833
   }
4834 4834
 
4835 4835
   /**
@@ -4916,7 +4916,7 @@  discard block
 block discarded – undo
4916 4916
         ) {
4917 4917
 
4918 4918
           if (($str[$i + 1] & "\xC0") === "\x80") {
4919
-            $ret[] = $str[$i] . $str[$i + 1];
4919
+            $ret[] = $str[$i].$str[$i + 1];
4920 4920
 
4921 4921
             $i++;
4922 4922
           }
@@ -4932,7 +4932,7 @@  discard block
 block discarded – undo
4932 4932
               &&
4933 4933
               ($str[$i + 2] & "\xC0") === "\x80"
4934 4934
           ) {
4935
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2];
4935
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2];
4936 4936
 
4937 4937
             $i += 2;
4938 4938
           }
@@ -4950,7 +4950,7 @@  discard block
 block discarded – undo
4950 4950
               &&
4951 4951
               ($str[$i + 3] & "\xC0") === "\x80"
4952 4952
           ) {
4953
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3];
4953
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3];
4954 4954
 
4955 4955
             $i += 3;
4956 4956
           }
@@ -4963,7 +4963,7 @@  discard block
 block discarded – undo
4963 4963
       $ret = \array_chunk($ret, $length);
4964 4964
 
4965 4965
       return \array_map(
4966
-          function ($item) {
4966
+          function($item) {
4967 4967
             return \implode('', $item);
4968 4968
           }, $ret
4969 4969
       );
@@ -4993,7 +4993,7 @@  discard block
 block discarded – undo
4993 4993
 
4994 4994
     $str = (string)\preg_replace_callback(
4995 4995
         '/[-_\s]+(.)?/u',
4996
-        function ($match) use ($encoding) {
4996
+        function($match) use ($encoding) {
4997 4997
           if (isset($match[1])) {
4998 4998
             return UTF8::strtoupper($match[1], $encoding);
4999 4999
           }
@@ -5005,7 +5005,7 @@  discard block
 block discarded – undo
5005 5005
 
5006 5006
     $str = (string)\preg_replace_callback(
5007 5007
         '/[\d]+(.)?/u',
5008
-        function ($match) use ($encoding) {
5008
+        function($match) use ($encoding) {
5009 5009
           return UTF8::strtoupper($match[0], $encoding);
5010 5010
         },
5011 5011
         $str
@@ -5372,7 +5372,7 @@  discard block
 block discarded – undo
5372 5372
     foreach (self::$ENCODINGS as $encodingTmp) {
5373 5373
       # INFO: //IGNORE but still throw notice
5374 5374
       /** @noinspection PhpUsageOfSilenceOperatorInspection */
5375
-      if ((string)@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) {
5375
+      if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) {
5376 5376
         return $encodingTmp;
5377 5377
       }
5378 5378
     }
@@ -5434,7 +5434,7 @@  discard block
 block discarded – undo
5434 5434
   public static function str_ensure_left(string $str, string $substring): string
5435 5435
   {
5436 5436
     if (!self::str_starts_with($str, $substring)) {
5437
-      $str = $substring . $str;
5437
+      $str = $substring.$str;
5438 5438
     }
5439 5439
 
5440 5440
     return $str;
@@ -5643,7 +5643,7 @@  discard block
 block discarded – undo
5643 5643
     $start = self::substr($str, 0, $index, $encoding);
5644 5644
     $end = self::substr($str, $index, $len, $encoding);
5645 5645
 
5646
-    return $start . $substring . $end;
5646
+    return $start.$substring.$end;
5647 5647
   }
5648 5648
 
5649 5649
   /**
@@ -5680,7 +5680,7 @@  discard block
 block discarded – undo
5680 5680
       if ('' === $s .= '') {
5681 5681
         $s = '/^(?<=.)$/';
5682 5682
       } else {
5683
-        $s = '/' . \preg_quote($s, '/') . '/ui';
5683
+        $s = '/'.\preg_quote($s, '/').'/ui';
5684 5684
       }
5685 5685
     }
5686 5686
 
@@ -5963,7 +5963,7 @@  discard block
 block discarded – undo
5963 5963
       return $str;
5964 5964
     }
5965 5965
 
5966
-    return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding) . $strAddOn;
5966
+    return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding).$strAddOn;
5967 5967
   }
5968 5968
 
5969 5969
   /**
@@ -5991,7 +5991,7 @@  discard block
 block discarded – undo
5991 5991
     }
5992 5992
 
5993 5993
     if (self::substr($str, $length - 1, 1, $encoding) === ' ') {
5994
-      return self::substr($str, 0, $length - 1, $encoding) . $strAddOn;
5994
+      return self::substr($str, 0, $length - 1, $encoding).$strAddOn;
5995 5995
     }
5996 5996
 
5997 5997
     $str = (string)self::substr($str, 0, $length, $encoding);
@@ -6000,9 +6000,9 @@  discard block
 block discarded – undo
6000 6000
     $new_str = \implode(' ', $array);
6001 6001
 
6002 6002
     if ($new_str === '') {
6003
-      $str = self::substr($str, 0, $length - 1, $encoding) . $strAddOn;
6003
+      $str = self::substr($str, 0, $length - 1, $encoding).$strAddOn;
6004 6004
     } else {
6005
-      $str = $new_str . $strAddOn;
6005
+      $str = $new_str.$strAddOn;
6006 6006
     }
6007 6007
 
6008 6008
     return $str;
@@ -6105,7 +6105,7 @@  discard block
 block discarded – undo
6105 6105
       $char = self::substr($str, -$i, 1, $encoding);
6106 6106
 
6107 6107
       if ($char == self::substr($otherStr, -$i, 1, $encoding)) {
6108
-        $longestCommonSuffix = $char . $longestCommonSuffix;
6108
+        $longestCommonSuffix = $char.$longestCommonSuffix;
6109 6109
       } else {
6110 6110
         break;
6111 6111
       }
@@ -6124,7 +6124,7 @@  discard block
 block discarded – undo
6124 6124
    */
6125 6125
   public static function str_matches_pattern(string $str, string $pattern): bool
6126 6126
   {
6127
-    if (\preg_match('/' . $pattern . '/u', $str)) {
6127
+    if (\preg_match('/'.$pattern.'/u', $str)) {
6128 6128
       return true;
6129 6129
     }
6130 6130
 
@@ -6214,7 +6214,7 @@  discard block
 block discarded – undo
6214 6214
         $pad_type = STR_PAD_BOTH;
6215 6215
       } else {
6216 6216
         throw new \InvalidArgumentException(
6217
-            'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'"
6217
+            'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'"
6218 6218
         );
6219 6219
       }
6220 6220
     }
@@ -6251,7 +6251,7 @@  discard block
 block discarded – undo
6251 6251
           $pre = '';
6252 6252
       }
6253 6253
 
6254
-      return $pre . $str . $post;
6254
+      return $pre.$str.$post;
6255 6255
     }
6256 6256
 
6257 6257
     return $str;
@@ -6379,7 +6379,7 @@  discard block
 block discarded – undo
6379 6379
   {
6380 6380
     return self::regex_replace(
6381 6381
         $str,
6382
-        '^' . \preg_quote($search, '/'),
6382
+        '^'.\preg_quote($search, '/'),
6383 6383
         self::str_replace('\\', '\\\\', $replacement)
6384 6384
     );
6385 6385
   }
@@ -6397,7 +6397,7 @@  discard block
 block discarded – undo
6397 6397
   {
6398 6398
     return self::regex_replace(
6399 6399
         $str,
6400
-        \preg_quote($search, '/') . '$',
6400
+        \preg_quote($search, '/').'$',
6401 6401
         self::str_replace('\\', '\\\\', $replacement)
6402 6402
     );
6403 6403
   }
@@ -6508,24 +6508,24 @@  discard block
 block discarded – undo
6508 6508
 
6509 6509
     $str = (string)\preg_replace_callback(
6510 6510
         '/([\d|A-Z])/u',
6511
-        function ($matches) use ($encoding) {
6511
+        function($matches) use ($encoding) {
6512 6512
           $match = $matches[1];
6513 6513
           $matchInt = (int)$match;
6514 6514
 
6515 6515
           if ((string)$matchInt == $match) {
6516
-            return '_' . $match . '_';
6516
+            return '_'.$match.'_';
6517 6517
           }
6518 6518
 
6519
-          return '_' . UTF8::strtolower($match, $encoding);
6519
+          return '_'.UTF8::strtolower($match, $encoding);
6520 6520
         },
6521 6521
         $str
6522 6522
     );
6523 6523
 
6524 6524
     $str = (string)\preg_replace(
6525 6525
         [
6526
-            '/\s+/',        // convert spaces to "_"
6527
-            '/^\s+|\s+$/',  // trim leading & trailing spaces
6528
-            '/_+/',         // remove double "_"
6526
+            '/\s+/', // convert spaces to "_"
6527
+            '/^\s+|\s+$/', // trim leading & trailing spaces
6528
+            '/_+/', // remove double "_"
6529 6529
         ],
6530 6530
         [
6531 6531
             '_',
@@ -6613,7 +6613,7 @@  discard block
 block discarded – undo
6613 6613
       $limit = -1;
6614 6614
     }
6615 6615
 
6616
-    $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit);
6616
+    $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit);
6617 6617
 
6618 6618
     if ($array === false) {
6619 6619
       return [];
@@ -6895,7 +6895,7 @@  discard block
 block discarded – undo
6895 6895
 
6896 6896
     $str = (string)\preg_replace_callback(
6897 6897
         '/([\S]+)/u',
6898
-        function ($match) use ($encoding, $ignore) {
6898
+        function($match) use ($encoding, $ignore) {
6899 6899
           if ($ignore && \in_array($match[0], $ignore, true)) {
6900 6900
             return $match[0];
6901 6901
           }
@@ -6964,16 +6964,16 @@  discard block
 block discarded – undo
6964 6964
     $str = (string)\preg_replace_callback(
6965 6965
         '~\b (_*) (?:                                                              # 1. Leading underscore and
6966 6966
                         ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ |              # 2. file path or 
6967
-                          [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) #    URL, domain, or email
6967
+                          [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) #    URL, domain, or email
6968 6968
                         |
6969
-                        ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' )            # 3. or small word (case-insensitive)
6969
+                        ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' )            # 3. or small word (case-insensitive)
6970 6970
                         |
6971
-                        ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' )     # 4. or word w/o internal caps
6971
+                        ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' )     # 4. or word w/o internal caps
6972 6972
                         |
6973
-                        ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' )     # 5. or some other word
6973
+                        ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' )     # 5. or some other word
6974 6974
                       ) (_*) \b                                                           # 6. With trailing underscore
6975 6975
                     ~ux',
6976
-        function ($matches) use ($encoding) {
6976
+        function($matches) use ($encoding) {
6977 6977
           // Preserve leading underscore
6978 6978
           $str = $matches[1];
6979 6979
           if ($matches[2]) {
@@ -7002,21 +7002,21 @@  discard block
 block discarded – undo
7002 7002
         '~(  \A [[:punct:]]*                # start of title...
7003 7003
                       |  [:.;?!][ ]+               # or of subsentence...
7004 7004
                       |  [ ][\'"“‘(\[][ ]* )       # or of inserted subphrase...
7005
-                      ( ' . $smallWordsRx . ' ) \b # ...followed by small word
7005
+                      ( ' . $smallWordsRx.' ) \b # ...followed by small word
7006 7006
                      ~uxi',
7007
-        function ($matches) use ($encoding) {
7008
-          return $matches[1] . static::str_upper_first($matches[2], $encoding);
7007
+        function($matches) use ($encoding) {
7008
+          return $matches[1].static::str_upper_first($matches[2], $encoding);
7009 7009
         },
7010 7010
         $str
7011 7011
     );
7012 7012
 
7013 7013
     // ...and end of title
7014 7014
     $str = (string)\preg_replace_callback(
7015
-        '~\b ( ' . $smallWordsRx . ' ) # small word...
7015
+        '~\b ( '.$smallWordsRx.' ) # small word...
7016 7016
                       (?= [[:punct:]]* \Z     # ...at the end of the title...
7017 7017
                       |   [\'"’”)\]] [ ] )    # ...or of an inserted subphrase?
7018 7018
                      ~uxi',
7019
-        function ($matches) use ($encoding) {
7019
+        function($matches) use ($encoding) {
7020 7020
           return static::str_upper_first($matches[1], $encoding);
7021 7021
         },
7022 7022
         $str
@@ -7027,10 +7027,10 @@  discard block
 block discarded – undo
7027 7027
     $str = (string)\preg_replace_callback(
7028 7028
         '~\b
7029 7029
                         (?<! -)                   # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight)
7030
-                        ( ' . $smallWordsRx . ' )
7030
+                        ( ' . $smallWordsRx.' )
7031 7031
                         (?= -[[:alpha:]]+)        # lookahead for "-someword"
7032 7032
                        ~uxi',
7033
-        function ($matches) use ($encoding) {
7033
+        function($matches) use ($encoding) {
7034 7034
           return static::str_upper_first($matches[1], $encoding);
7035 7035
         },
7036 7036
         $str
@@ -7041,11 +7041,11 @@  discard block
 block discarded – undo
7041 7041
         '~\b
7042 7042
                       (?<!…)                    # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in)
7043 7043
                       ( [[:alpha:]]+- )         # $1 = first word and hyphen, should already be properly capped
7044
-                      ( ' . $smallWordsRx . ' ) # ...followed by small word
7044
+                      ( ' . $smallWordsRx.' ) # ...followed by small word
7045 7045
                       (?!	- )                   # Negative lookahead for another -
7046 7046
                      ~uxi',
7047
-        function ($matches) use ($encoding) {
7048
-          return $matches[1] . static::str_upper_first($matches[2], $encoding);
7047
+        function($matches) use ($encoding) {
7048
+          return $matches[1].static::str_upper_first($matches[2], $encoding);
7049 7049
         },
7050 7050
         $str
7051 7051
     );
@@ -7195,7 +7195,7 @@  discard block
 block discarded – undo
7195 7195
 
7196 7196
     $truncated = self::substr($str, 0, $length, $encoding);
7197 7197
 
7198
-    return $truncated . $substring;
7198
+    return $truncated.$substring;
7199 7199
   }
7200 7200
 
7201 7201
   /**
@@ -7237,7 +7237,7 @@  discard block
 block discarded – undo
7237 7237
       }
7238 7238
     }
7239 7239
 
7240
-    $str = $truncated . $substring;
7240
+    $str = $truncated.$substring;
7241 7241
 
7242 7242
     return $str;
7243 7243
   }
@@ -7386,7 +7386,7 @@  discard block
 block discarded – undo
7386 7386
   public static function strcmp(string $str1, string $str2): int
7387 7387
   {
7388 7388
     /** @noinspection PhpUndefinedClassInspection */
7389
-    return $str1 . '' === $str2 . '' ? 0 : \strcmp(
7389
+    return $str1.'' === $str2.'' ? 0 : \strcmp(
7390 7390
         \Normalizer::normalize($str1, \Normalizer::NFD),
7391 7391
         \Normalizer::normalize($str2, \Normalizer::NFD)
7392 7392
     );
@@ -7420,7 +7420,7 @@  discard block
 block discarded – undo
7420 7420
       return null;
7421 7421
     }
7422 7422
 
7423
-    if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) {
7423
+    if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) {
7424 7424
       return self::strlen($length[1]);
7425 7425
     }
7426 7426
 
@@ -7657,7 +7657,7 @@  discard block
 block discarded – undo
7657 7657
         &&
7658 7658
         self::$SUPPORT['mbstring'] === false
7659 7659
     ) {
7660
-      \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7660
+      \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7661 7661
     }
7662 7662
 
7663 7663
     if (self::$SUPPORT['mbstring'] === true) {
@@ -7679,7 +7679,7 @@  discard block
 block discarded – undo
7679 7679
       return \stristr($haystack, $needle, $before_needle);
7680 7680
     }
7681 7681
 
7682
-    \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match);
7682
+    \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match);
7683 7683
 
7684 7684
     if (!isset($match[1])) {
7685 7685
       return false;
@@ -7746,7 +7746,7 @@  discard block
 block discarded – undo
7746 7746
         &&
7747 7747
         self::$SUPPORT['iconv'] === false
7748 7748
     ) {
7749
-      \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7749
+      \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7750 7750
     }
7751 7751
 
7752 7752
     //
@@ -7872,7 +7872,7 @@  discard block
 block discarded – undo
7872 7872
    */
7873 7873
   public static function strnatcmp(string $str1, string $str2): int
7874 7874
   {
7875
-    return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
7875
+    return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
7876 7876
   }
7877 7877
 
7878 7878
   /**
@@ -7937,7 +7937,7 @@  discard block
 block discarded – undo
7937 7937
       return false;
7938 7938
     }
7939 7939
 
7940
-    if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) {
7940
+    if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) {
7941 7941
       return \substr($haystack, (int)\strpos($haystack, $m[0]));
7942 7942
     }
7943 7943
 
@@ -8009,7 +8009,7 @@  discard block
 block discarded – undo
8009 8009
         &&
8010 8010
         self::$SUPPORT['mbstring'] === false
8011 8011
     ) {
8012
-      \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8012
+      \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8013 8013
     }
8014 8014
 
8015 8015
     //
@@ -8175,7 +8175,7 @@  discard block
 block discarded – undo
8175 8175
         &&
8176 8176
         self::$SUPPORT['mbstring'] === false
8177 8177
     ) {
8178
-      \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8178
+      \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8179 8179
     }
8180 8180
 
8181 8181
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8396,7 +8396,7 @@  discard block
 block discarded – undo
8396 8396
         &&
8397 8397
         self::$SUPPORT['mbstring'] === false
8398 8398
     ) {
8399
-      \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8399
+      \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8400 8400
     }
8401 8401
 
8402 8402
     //
@@ -8543,7 +8543,7 @@  discard block
 block discarded – undo
8543 8543
         &&
8544 8544
         self::$SUPPORT['mbstring'] === false
8545 8545
     ) {
8546
-      \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8546
+      \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8547 8547
     }
8548 8548
 
8549 8549
     //
@@ -8674,7 +8674,7 @@  discard block
 block discarded – undo
8674 8674
       return 0;
8675 8675
     }
8676 8676
 
8677
-    return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0;
8677
+    return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0;
8678 8678
   }
8679 8679
 
8680 8680
   /**
@@ -8730,7 +8730,7 @@  discard block
 block discarded – undo
8730 8730
         &&
8731 8731
         self::$SUPPORT['mbstring'] === false
8732 8732
     ) {
8733
-      \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8733
+      \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8734 8734
     }
8735 8735
 
8736 8736
     //
@@ -8768,7 +8768,7 @@  discard block
 block discarded – undo
8768 8768
     // fallback via vanilla php
8769 8769
     //
8770 8770
 
8771
-    \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match);
8771
+    \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match);
8772 8772
 
8773 8773
     if (!isset($match[1])) {
8774 8774
       return false;
@@ -8906,9 +8906,9 @@  discard block
 block discarded – undo
8906 8906
 
8907 8907
       if (self::$SUPPORT['intl'] === true) {
8908 8908
 
8909
-        $langCode = $lang . '-Lower';
8909
+        $langCode = $lang.'-Lower';
8910 8910
         if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
8911
-          \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, E_USER_WARNING);
8911
+          \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, E_USER_WARNING);
8912 8912
 
8913 8913
           $langCode = 'Any-Lower';
8914 8914
         }
@@ -8917,7 +8917,7 @@  discard block
 block discarded – undo
8917 8917
         return transliterator_transliterate($langCode, $str);
8918 8918
       }
8919 8919
 
8920
-      \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, E_USER_WARNING);
8920
+      \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, E_USER_WARNING);
8921 8921
     }
8922 8922
 
8923 8923
     // always fallback via symfony polyfill
@@ -8982,9 +8982,9 @@  discard block
 block discarded – undo
8982 8982
 
8983 8983
       if (self::$SUPPORT['intl'] === true) {
8984 8984
 
8985
-        $langCode = $lang . '-Upper';
8985
+        $langCode = $lang.'-Upper';
8986 8986
         if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
8987
-          \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, E_USER_WARNING);
8987
+          \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, E_USER_WARNING);
8988 8988
 
8989 8989
           $langCode = 'Any-Upper';
8990 8990
         }
@@ -8993,7 +8993,7 @@  discard block
 block discarded – undo
8993 8993
         return transliterator_transliterate($langCode, $str);
8994 8994
       }
8995 8995
 
8996
-      \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING);
8996
+      \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING);
8997 8997
     }
8998 8998
 
8999 8999
     // always fallback via symfony polyfill
@@ -9200,7 +9200,7 @@  discard block
 block discarded – undo
9200 9200
         &&
9201 9201
         self::$SUPPORT['mbstring'] === false
9202 9202
     ) {
9203
-      \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
9203
+      \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
9204 9204
     }
9205 9205
 
9206 9206
     //
@@ -9380,14 +9380,14 @@  discard block
 block discarded – undo
9380 9380
         &&
9381 9381
         self::$SUPPORT['mbstring'] === false
9382 9382
     ) {
9383
-      \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
9383
+      \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
9384 9384
     }
9385 9385
 
9386 9386
     if (self::$SUPPORT['mbstring'] === true) {
9387 9387
       return \mb_substr_count($haystack, $needle, $encoding);
9388 9388
     }
9389 9389
 
9390
-    \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER);
9390
+    \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER);
9391 9391
 
9392 9392
     return \count($matches);
9393 9393
   }
@@ -9711,8 +9711,7 @@  discard block
 block discarded – undo
9711 9711
 
9712 9712
     if (self::is_ascii($str)) {
9713 9713
       return ($length === null) ?
9714
-          \substr_replace($str, $replacement, $offset) :
9715
-          \substr_replace($str, $replacement, $offset, $length);
9714
+          \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length);
9716 9715
     }
9717 9716
 
9718 9717
     \preg_match_all('/./us', $str, $smatches);
@@ -10198,7 +10197,7 @@  discard block
 block discarded – undo
10198 10197
           $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1];
10199 10198
 
10200 10199
           if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already
10201
-            $buf .= $c1 . $c2;
10200
+            $buf .= $c1.$c2;
10202 10201
             $i++;
10203 10202
           } else { // not valid UTF8 - convert it
10204 10203
             $buf .= self::to_utf8_convert_helper($c1);
@@ -10210,7 +10209,7 @@  discard block
 block discarded – undo
10210 10209
           $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2];
10211 10210
 
10212 10211
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already
10213
-            $buf .= $c1 . $c2 . $c3;
10212
+            $buf .= $c1.$c2.$c3;
10214 10213
             $i += 2;
10215 10214
           } else { // not valid UTF8 - convert it
10216 10215
             $buf .= self::to_utf8_convert_helper($c1);
@@ -10223,7 +10222,7 @@  discard block
 block discarded – undo
10223 10222
           $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3];
10224 10223
 
10225 10224
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already
10226
-            $buf .= $c1 . $c2 . $c3 . $c4;
10225
+            $buf .= $c1.$c2.$c3.$c4;
10227 10226
             $i += 3;
10228 10227
           } else { // not valid UTF8 - convert it
10229 10228
             $buf .= self::to_utf8_convert_helper($c1);
@@ -10245,7 +10244,7 @@  discard block
 block discarded – undo
10245 10244
     // decode unicode escape sequences
10246 10245
     $buf = \preg_replace_callback(
10247 10246
         '/\\\\u([0-9a-f]{4})/i',
10248
-        function ($match) {
10247
+        function($match) {
10249 10248
           // always fallback via symfony polyfill
10250 10249
           return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
10251 10250
         },
@@ -10288,7 +10287,7 @@  discard block
 block discarded – undo
10288 10287
     } else {
10289 10288
       $cc1 = self::$CHR[$ordC1 / 64] | "\xC0";
10290 10289
       $cc2 = ((string)$input & "\x3F") | "\x80";
10291
-      $buf .= $cc1 . $cc2;
10290
+      $buf .= $cc1.$cc2;
10292 10291
     }
10293 10292
 
10294 10293
     return $buf;
@@ -10352,7 +10351,7 @@  discard block
 block discarded – undo
10352 10351
         $cleanUtf8
10353 10352
     );
10354 10353
 
10355
-    return $strPartOne . $strPartTwo;
10354
+    return $strPartOne.$strPartTwo;
10356 10355
   }
10357 10356
 
10358 10357
   /**
@@ -10397,7 +10396,7 @@  discard block
 block discarded – undo
10397 10396
       $str = self::clean($str);
10398 10397
     }
10399 10398
 
10400
-    $usePhpDefaultFunctions = !(bool)($charlist . \implode('', $exceptions));
10399
+    $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions));
10401 10400
 
10402 10401
     if (
10403 10402
         $usePhpDefaultFunctions === true
@@ -10901,7 +10900,7 @@  discard block
 block discarded – undo
10901 10900
       return '';
10902 10901
     }
10903 10902
 
10904
-    \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches);
10903
+    \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches);
10905 10904
 
10906 10905
     if (
10907 10906
         !isset($matches[0])
@@ -10911,7 +10910,7 @@  discard block
 block discarded – undo
10911 10910
       return $str;
10912 10911
     }
10913 10912
 
10914
-    return self::rtrim($matches[0]) . $strAddOn;
10913
+    return self::rtrim($matches[0]).$strAddOn;
10915 10914
   }
10916 10915
 
10917 10916
   /**
@@ -10982,7 +10981,7 @@  discard block
 block discarded – undo
10982 10981
       $strReturn .= $break;
10983 10982
     }
10984 10983
 
10985
-    return $strReturn . \implode('', $chars);
10984
+    return $strReturn.\implode('', $chars);
10986 10985
   }
10987 10986
 
10988 10987
   /**
Please login to merge, or discard this patch.