Passed
Pull Request — master (#75)
by Lars
09:37
created
src/voku/helper/UTF8.php 1 patch
Spacing   +120 added lines, -121 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
   public static function add_bom_to_string(string $str): string
244 244
   {
245 245
     if (self::string_has_bom($str) === false) {
246
-      $str = self::bom() . $str;
246
+      $str = self::bom().$str;
247 247
     }
248 248
 
249 249
     return $str;
@@ -510,10 +510,10 @@  discard block
 block discarded – undo
510 510
         &&
511 511
         self::$SUPPORT['mbstring'] === false
512 512
     ) {
513
-      \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
513
+      \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
514 514
     }
515 515
 
516
-    $cacheKey = $code_point . $encoding;
516
+    $cacheKey = $code_point.$encoding;
517 517
     if (isset($CHAR_CACHE[$cacheKey]) === true) {
518 518
       return $CHAR_CACHE[$cacheKey];
519 519
     }
@@ -558,16 +558,16 @@  discard block
 block discarded – undo
558 558
     if ($code_point <= 0x7F) {
559 559
       $chr = self::$CHR[$code_point];
560 560
     } elseif ($code_point <= 0x7FF) {
561
-      $chr = self::$CHR[($code_point >> 6) + 0xC0] .
561
+      $chr = self::$CHR[($code_point >> 6) + 0xC0].
562 562
              self::$CHR[($code_point & 0x3F) + 0x80];
563 563
     } elseif ($code_point <= 0xFFFF) {
564
-      $chr = self::$CHR[($code_point >> 12) + 0xE0] .
565
-             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] .
564
+      $chr = self::$CHR[($code_point >> 12) + 0xE0].
565
+             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80].
566 566
              self::$CHR[($code_point & 0x3F) + 0x80];
567 567
     } else {
568
-      $chr = self::$CHR[($code_point >> 18) + 0xF0] .
569
-             self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] .
570
-             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] .
568
+      $chr = self::$CHR[($code_point >> 18) + 0xF0].
569
+             self::$CHR[(($code_point >> 12) & 0x3F) + 0x80].
570
+             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80].
571 571
              self::$CHR[($code_point & 0x3F) + 0x80];
572 572
     }
573 573
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 
620 620
     if (self::$SUPPORT['mbstring_func_overload'] === true) {
621 621
       return \array_map(
622
-          function ($data) {
622
+          function($data) {
623 623
             return UTF8::strlen_in_byte($data);
624 624
           },
625 625
           $strSplit
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
    */
935 935
   public static function decimal_to_chr($int): string
936 936
   {
937
-    return self::html_entity_decode('&#' . $int . ';', ENT_QUOTES | ENT_HTML5);
937
+    return self::html_entity_decode('&#'.$int.';', ENT_QUOTES | ENT_HTML5);
938 938
   }
939 939
 
940 940
   /**
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
           &&
1015 1015
           self::$SUPPORT['mbstring'] === false
1016 1016
       ) {
1017
-        \trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1017
+        \trigger_error('UTF8::encode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
1018 1018
       }
1019 1019
 
1020 1020
       // always fallback via symfony polyfill
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
           return '';
1077 1077
         }
1078 1078
 
1079
-        return \rtrim($strSub, $trimChars) . $replacerForSkippedText;
1079
+        return \rtrim($strSub, $trimChars).$replacerForSkippedText;
1080 1080
       }
1081 1081
 
1082 1082
       return $str;
@@ -1112,14 +1112,14 @@  discard block
 block discarded – undo
1112 1112
       if (!$pos_end || $pos_end <= 0) {
1113 1113
         $strSub = self::substr($str, $pos_start, self::strlen($str), $encoding);
1114 1114
         if ($strSub !== false) {
1115
-          $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars);
1115
+          $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars);
1116 1116
         } else {
1117 1117
           $extract = '';
1118 1118
         }
1119 1119
       } else {
1120 1120
         $strSub = self::substr($str, $pos_start, $pos_end, $encoding);
1121 1121
         if ($strSub !== false) {
1122
-          $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText;
1122
+          $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText;
1123 1123
         } else {
1124 1124
           $extract = '';
1125 1125
         }
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
       if ($pos_end) {
1143 1143
         $strSub = self::substr($str, 0, $pos_end, $encoding);
1144 1144
         if ($strSub !== false) {
1145
-          $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText;
1145
+          $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText;
1146 1146
         } else {
1147 1147
           $extract = '';
1148 1148
         }
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
   {
1261 1261
     $file_content = \file_get_contents($file_path);
1262 1262
     if ($file_content === false) {
1263
-      throw new \RuntimeException('file_get_contents() returned false for:' . $file_path);
1263
+      throw new \RuntimeException('file_get_contents() returned false for:'.$file_path);
1264 1264
     }
1265 1265
 
1266 1266
     return self::string_has_bom($file_content);
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
           ) {
1321 1321
             // Prevent leading combining chars
1322 1322
             // for NFC-safe concatenations.
1323
-            $var = $leading_combining . $var;
1323
+            $var = $leading_combining.$var;
1324 1324
           }
1325 1325
         }
1326 1326
 
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
    */
1806 1806
   private static function getData(string $file)
1807 1807
   {
1808
-    $file = __DIR__ . '/data/' . $file . '.php';
1808
+    $file = __DIR__.'/data/'.$file.'.php';
1809 1809
     if (\file_exists($file)) {
1810 1810
       /** @noinspection PhpIncludeInspection */
1811 1811
       return require $file;
@@ -1883,16 +1883,16 @@  discard block
 block discarded – undo
1883 1883
    */
1884 1884
   public static function get_unique_string($entropyExtra = '', bool $md5 = true): string
1885 1885
   {
1886
-    $uniqueHelper = \mt_rand() .
1887
-                    \session_id() .
1888
-                    ($_SERVER['REMOTE_ADDR'] ?? '') .
1889
-                    ($_SERVER['SERVER_ADDR'] ?? '') .
1886
+    $uniqueHelper = \mt_rand().
1887
+                    \session_id().
1888
+                    ($_SERVER['REMOTE_ADDR'] ?? '').
1889
+                    ($_SERVER['SERVER_ADDR'] ?? '').
1890 1890
                     $entropyExtra;
1891 1891
 
1892 1892
     $uniqueString = \uniqid($uniqueHelper, true);
1893 1893
 
1894 1894
     if ($md5) {
1895
-      $uniqueString = \md5($uniqueString . $uniqueHelper);
1895
+      $uniqueString = \md5($uniqueString.$uniqueHelper);
1896 1896
     }
1897 1897
 
1898 1898
     return $uniqueString;
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
     return \implode(
2031 2031
         '',
2032 2032
         \array_map(
2033
-            function ($data) use ($keepAsciiChars, $encoding) {
2033
+            function($data) use ($keepAsciiChars, $encoding) {
2034 2034
               return UTF8::single_chr_html_encode($data, $keepAsciiChars, $encoding);
2035 2035
             },
2036 2036
             self::split($str)
@@ -2146,7 +2146,7 @@  discard block
 block discarded – undo
2146 2146
         &&
2147 2147
         self::$SUPPORT['mbstring'] === false
2148 2148
     ) {
2149
-      \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
2149
+      \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
2150 2150
     }
2151 2151
 
2152 2152
     do {
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 
2155 2155
       $str = (string)\preg_replace_callback(
2156 2156
           "/&#\d{2,6};/",
2157
-          function ($matches) use ($encoding) {
2157
+          function($matches) use ($encoding) {
2158 2158
             // always fallback via symfony polyfill
2159 2159
             $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES');
2160 2160
 
@@ -2495,9 +2495,9 @@  discard block
 block discarded – undo
2495 2495
   {
2496 2496
     $hex = \dechex($int);
2497 2497
 
2498
-    $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex);
2498
+    $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex);
2499 2499
 
2500
-    return $pfix . $hex . '';
2500
+    return $pfix.$hex.'';
2501 2501
   }
2502 2502
 
2503 2503
   /**
@@ -2758,7 +2758,7 @@  discard block
 block discarded – undo
2758 2758
     }
2759 2759
 
2760 2760
     $str_info = \unpack('C2chars', $str_info);
2761
-    $type_code = (int)($str_info['chars1'] . $str_info['chars2']);
2761
+    $type_code = (int)($str_info['chars1'].$str_info['chars2']);
2762 2762
 
2763 2763
     // DEBUG
2764 2764
     //var_dump($type_code);
@@ -3502,7 +3502,7 @@  discard block
 block discarded – undo
3502 3502
         $cleanUtf8
3503 3503
     );
3504 3504
 
3505
-    return $strPartOne . $strPartTwo;
3505
+    return $strPartOne.$strPartTwo;
3506 3506
   }
3507 3507
 
3508 3508
   /**
@@ -3969,7 +3969,7 @@  discard block
 block discarded – undo
3969 3969
       }
3970 3970
     }
3971 3971
 
3972
-    $cacheKey = $chr_orig . $encoding;
3972
+    $cacheKey = $chr_orig.$encoding;
3973 3973
     if (isset($CHAR_CACHE[$cacheKey]) === true) {
3974 3974
       return $CHAR_CACHE[$cacheKey];
3975 3975
     }
@@ -4211,7 +4211,7 @@  discard block
 block discarded – undo
4211 4211
     }
4212 4212
 
4213 4213
     $str = (string)\preg_replace(
4214
-        $delimiter . $pattern . $delimiter . 'u' . $options,
4214
+        $delimiter.$pattern.$delimiter.'u'.$options,
4215 4215
         $replacement,
4216 4216
         $str
4217 4217
     );
@@ -4282,7 +4282,7 @@  discard block
 block discarded – undo
4282 4282
     if (\is_array($what) === true) {
4283 4283
       /** @noinspection ForeachSourceInspection */
4284 4284
       foreach ($what as $item) {
4285
-        $str = (string)\preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str);
4285
+        $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str);
4286 4286
       }
4287 4287
     }
4288 4288
 
@@ -4530,7 +4530,7 @@  discard block
 block discarded – undo
4530 4530
   {
4531 4531
     static $RX_CLASSS_CACHE = [];
4532 4532
 
4533
-    $cacheKey = $s . $class;
4533
+    $cacheKey = $s.$class;
4534 4534
 
4535 4535
     if (isset($RX_CLASSS_CACHE[$cacheKey])) {
4536 4536
       return $RX_CLASSS_CACHE[$cacheKey];
@@ -4542,7 +4542,7 @@  discard block
 block discarded – undo
4542 4542
     /** @noinspection SuspiciousLoopInspection */
4543 4543
     foreach (self::str_split($s) as $s) {
4544 4544
       if ('-' === $s) {
4545
-        $class[0] = '-' . $class[0];
4545
+        $class[0] = '-'.$class[0];
4546 4546
       } elseif (!isset($s[2])) {
4547 4547
         $class[0] .= \preg_quote($s, '/');
4548 4548
       } elseif (1 === self::strlen($s)) {
@@ -4553,13 +4553,13 @@  discard block
 block discarded – undo
4553 4553
     }
4554 4554
 
4555 4555
     if ($class[0]) {
4556
-      $class[0] = '[' . $class[0] . ']';
4556
+      $class[0] = '['.$class[0].']';
4557 4557
     }
4558 4558
 
4559 4559
     if (1 === \count($class)) {
4560 4560
       $return = $class[0];
4561 4561
     } else {
4562
-      $return = '(?:' . \implode('|', $class) . ')';
4562
+      $return = '(?:'.\implode('|', $class).')';
4563 4563
     }
4564 4564
 
4565 4565
     $RX_CLASSS_CACHE[$cacheKey] = $return;
@@ -4578,7 +4578,7 @@  discard block
 block discarded – undo
4578 4578
 
4579 4579
     echo '<pre>';
4580 4580
     foreach (self::$SUPPORT as $key => $value) {
4581
-      echo $key . ' - ' . \print_r($value, true) . "\n<br>";
4581
+      echo $key.' - '.\print_r($value, true)."\n<br>";
4582 4582
     }
4583 4583
     echo '</pre>';
4584 4584
   }
@@ -4610,7 +4610,7 @@  discard block
 block discarded – undo
4610 4610
       $encoding = self::normalize_encoding($encoding, 'UTF-8');
4611 4611
     }
4612 4612
 
4613
-    return '&#' . self::ord($char, $encoding) . ';';
4613
+    return '&#'.self::ord($char, $encoding).';';
4614 4614
   }
4615 4615
 
4616 4616
   /**
@@ -4685,7 +4685,7 @@  discard block
 block discarded – undo
4685 4685
         ) {
4686 4686
 
4687 4687
           if (($str[$i + 1] & "\xC0") === "\x80") {
4688
-            $ret[] = $str[$i] . $str[$i + 1];
4688
+            $ret[] = $str[$i].$str[$i + 1];
4689 4689
 
4690 4690
             $i++;
4691 4691
           }
@@ -4701,7 +4701,7 @@  discard block
 block discarded – undo
4701 4701
               &&
4702 4702
               ($str[$i + 2] & "\xC0") === "\x80"
4703 4703
           ) {
4704
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2];
4704
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2];
4705 4705
 
4706 4706
             $i += 2;
4707 4707
           }
@@ -4719,7 +4719,7 @@  discard block
 block discarded – undo
4719 4719
               &&
4720 4720
               ($str[$i + 3] & "\xC0") === "\x80"
4721 4721
           ) {
4722
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3];
4722
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3];
4723 4723
 
4724 4724
             $i += 3;
4725 4725
           }
@@ -4732,7 +4732,7 @@  discard block
 block discarded – undo
4732 4732
       $ret = \array_chunk($ret, $length);
4733 4733
 
4734 4734
       return \array_map(
4735
-          function ($item) {
4735
+          function($item) {
4736 4736
             return \implode('', $item);
4737 4737
           }, $ret
4738 4738
       );
@@ -4762,7 +4762,7 @@  discard block
 block discarded – undo
4762 4762
 
4763 4763
     $str = (string)\preg_replace_callback(
4764 4764
         '/[-_\s]+(.)?/u',
4765
-        function ($match) use ($encoding) {
4765
+        function($match) use ($encoding) {
4766 4766
           if (isset($match[1])) {
4767 4767
             return UTF8::strtoupper($match[1], $encoding);
4768 4768
           }
@@ -4774,7 +4774,7 @@  discard block
 block discarded – undo
4774 4774
 
4775 4775
     $str = (string)\preg_replace_callback(
4776 4776
         '/[\d]+(.)?/u',
4777
-        function ($match) use ($encoding) {
4777
+        function($match) use ($encoding) {
4778 4778
           return UTF8::strtoupper($match[0], $encoding);
4779 4779
         },
4780 4780
         $str
@@ -5136,7 +5136,7 @@  discard block
 block discarded – undo
5136 5136
     foreach (self::$ENCODINGS as $encodingTmp) {
5137 5137
       # INFO: //IGNORE but still throw notice
5138 5138
       /** @noinspection PhpUsageOfSilenceOperatorInspection */
5139
-      if (\md5((string)@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) {
5139
+      if (\md5((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) {
5140 5140
         return $encodingTmp;
5141 5141
       }
5142 5142
     }
@@ -5198,7 +5198,7 @@  discard block
 block discarded – undo
5198 5198
   public static function str_ensure_left(string $str, string $substring): string
5199 5199
   {
5200 5200
     if (!self::str_starts_with($str, $substring)) {
5201
-      $str = $substring . $str;
5201
+      $str = $substring.$str;
5202 5202
     }
5203 5203
 
5204 5204
     return $str;
@@ -5407,7 +5407,7 @@  discard block
 block discarded – undo
5407 5407
     $start = self::substr($str, 0, $index, $encoding);
5408 5408
     $end = self::substr($str, $index, $len, $encoding);
5409 5409
 
5410
-    return $start . $substring . $end;
5410
+    return $start.$substring.$end;
5411 5411
   }
5412 5412
 
5413 5413
   /**
@@ -5444,7 +5444,7 @@  discard block
 block discarded – undo
5444 5444
       if ('' === $s .= '') {
5445 5445
         $s = '/^(?<=.)$/';
5446 5446
       } else {
5447
-        $s = '/' . \preg_quote($s, '/') . '/ui';
5447
+        $s = '/'.\preg_quote($s, '/').'/ui';
5448 5448
       }
5449 5449
     }
5450 5450
 
@@ -5727,7 +5727,7 @@  discard block
 block discarded – undo
5727 5727
       return $str;
5728 5728
     }
5729 5729
 
5730
-    return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding) . $strAddOn;
5730
+    return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding).$strAddOn;
5731 5731
   }
5732 5732
 
5733 5733
   /**
@@ -5755,7 +5755,7 @@  discard block
 block discarded – undo
5755 5755
     }
5756 5756
 
5757 5757
     if (self::substr($str, $length - 1, 1, $encoding) === ' ') {
5758
-      return self::substr($str, 0, $length - 1, $encoding) . $strAddOn;
5758
+      return self::substr($str, 0, $length - 1, $encoding).$strAddOn;
5759 5759
     }
5760 5760
 
5761 5761
     $str = (string)self::substr($str, 0, $length, $encoding);
@@ -5764,9 +5764,9 @@  discard block
 block discarded – undo
5764 5764
     $new_str = \implode(' ', $array);
5765 5765
 
5766 5766
     if ($new_str === '') {
5767
-      $str = self::substr($str, 0, $length - 1, $encoding) . $strAddOn;
5767
+      $str = self::substr($str, 0, $length - 1, $encoding).$strAddOn;
5768 5768
     } else {
5769
-      $str = $new_str . $strAddOn;
5769
+      $str = $new_str.$strAddOn;
5770 5770
     }
5771 5771
 
5772 5772
     return $str;
@@ -5869,7 +5869,7 @@  discard block
 block discarded – undo
5869 5869
       $char = self::substr($str, -$i, 1, $encoding);
5870 5870
 
5871 5871
       if ($char == self::substr($otherStr, -$i, 1, $encoding)) {
5872
-        $longestCommonSuffix = $char . $longestCommonSuffix;
5872
+        $longestCommonSuffix = $char.$longestCommonSuffix;
5873 5873
       } else {
5874 5874
         break;
5875 5875
       }
@@ -5888,7 +5888,7 @@  discard block
 block discarded – undo
5888 5888
    */
5889 5889
   public static function str_matches_pattern(string $str, string $pattern): bool
5890 5890
   {
5891
-    if (\preg_match('/' . $pattern . '/u', $str)) {
5891
+    if (\preg_match('/'.$pattern.'/u', $str)) {
5892 5892
       return true;
5893 5893
     }
5894 5894
 
@@ -5978,7 +5978,7 @@  discard block
 block discarded – undo
5978 5978
         $pad_type = STR_PAD_BOTH;
5979 5979
       } else {
5980 5980
         throw new \InvalidArgumentException(
5981
-            'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'"
5981
+            'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'"
5982 5982
         );
5983 5983
       }
5984 5984
     }
@@ -6015,7 +6015,7 @@  discard block
 block discarded – undo
6015 6015
           $pre = '';
6016 6016
       }
6017 6017
 
6018
-      return $pre . $str . $post;
6018
+      return $pre.$str.$post;
6019 6019
     }
6020 6020
 
6021 6021
     return $str;
@@ -6143,7 +6143,7 @@  discard block
 block discarded – undo
6143 6143
   {
6144 6144
     return self::regex_replace(
6145 6145
         $str,
6146
-        '^' . \preg_quote($search, '/'),
6146
+        '^'.\preg_quote($search, '/'),
6147 6147
         self::str_replace('\\', '\\\\', $replacement)
6148 6148
     );
6149 6149
   }
@@ -6161,7 +6161,7 @@  discard block
 block discarded – undo
6161 6161
   {
6162 6162
     return self::regex_replace(
6163 6163
         $str,
6164
-        \preg_quote($search, '/') . '$',
6164
+        \preg_quote($search, '/').'$',
6165 6165
         self::str_replace('\\', '\\\\', $replacement)
6166 6166
     );
6167 6167
   }
@@ -6274,24 +6274,24 @@  discard block
 block discarded – undo
6274 6274
 
6275 6275
     $str = (string)\preg_replace_callback(
6276 6276
         '/([\d|A-Z])/u',
6277
-        function ($matches) use ($encoding) {
6277
+        function($matches) use ($encoding) {
6278 6278
           $match = $matches[1];
6279 6279
           $matchInt = (int)$match;
6280 6280
 
6281 6281
           if ((string)$matchInt == $match) {
6282
-            return '_' . $match . '_';
6282
+            return '_'.$match.'_';
6283 6283
           }
6284 6284
 
6285
-          return '_' . UTF8::strtolower($match, $encoding);
6285
+          return '_'.UTF8::strtolower($match, $encoding);
6286 6286
         },
6287 6287
         $str
6288 6288
     );
6289 6289
 
6290 6290
     $str = (string)\preg_replace(
6291 6291
         [
6292
-            '/\s+/',        // convert spaces to "_"
6293
-            '/^\s+|\s+$/',  // trim leading & trailing spaces
6294
-            '/_+/',         // remove double "_"
6292
+            '/\s+/', // convert spaces to "_"
6293
+            '/^\s+|\s+$/', // trim leading & trailing spaces
6294
+            '/_+/', // remove double "_"
6295 6295
         ],
6296 6296
         [
6297 6297
             '_',
@@ -6360,7 +6360,7 @@  discard block
 block discarded – undo
6360 6360
     }
6361 6361
 
6362 6362
     /** @noinspection NotOptimalRegularExpressionsInspection */
6363
-    \preg_match_all('/' . self::GRAPHEME_CLUSTER_RX . '/u', $str, $a);
6363
+    \preg_match_all('/'.self::GRAPHEME_CLUSTER_RX.'/u', $str, $a);
6364 6364
     $a = $a[0];
6365 6365
 
6366 6366
     if ($len === 1) {
@@ -6413,7 +6413,7 @@  discard block
 block discarded – undo
6413 6413
       $limit = -1;
6414 6414
     }
6415 6415
 
6416
-    $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit);
6416
+    $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit);
6417 6417
 
6418 6418
     if ($array === false) {
6419 6419
       return [];
@@ -6695,7 +6695,7 @@  discard block
 block discarded – undo
6695 6695
 
6696 6696
     $str = (string)\preg_replace_callback(
6697 6697
         '/([\S]+)/u',
6698
-        function ($match) use ($encoding, $ignore) {
6698
+        function($match) use ($encoding, $ignore) {
6699 6699
           if ($ignore && \in_array($match[0], $ignore, true)) {
6700 6700
             return $match[0];
6701 6701
           }
@@ -6764,16 +6764,16 @@  discard block
 block discarded – undo
6764 6764
     $str = (string)\preg_replace_callback(
6765 6765
         '~\b (_*) (?:                                                              # 1. Leading underscore and
6766 6766
                         ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ |              # 2. file path or 
6767
-                          [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) #    URL, domain, or email
6767
+                          [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) #    URL, domain, or email
6768 6768
                         |
6769
-                        ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' )            # 3. or small word (case-insensitive)
6769
+                        ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' )            # 3. or small word (case-insensitive)
6770 6770
                         |
6771
-                        ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' )     # 4. or word w/o internal caps
6771
+                        ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' )     # 4. or word w/o internal caps
6772 6772
                         |
6773
-                        ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' )     # 5. or some other word
6773
+                        ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' )     # 5. or some other word
6774 6774
                       ) (_*) \b                                                           # 6. With trailing underscore
6775 6775
                     ~ux',
6776
-        function ($matches) use ($encoding) {
6776
+        function($matches) use ($encoding) {
6777 6777
           // Preserve leading underscore
6778 6778
           $str = $matches[1];
6779 6779
           if ($matches[2]) {
@@ -6802,21 +6802,21 @@  discard block
 block discarded – undo
6802 6802
         '~(  \A [[:punct:]]*                # start of title...
6803 6803
                       |  [:.;?!][ ]+               # or of subsentence...
6804 6804
                       |  [ ][\'"“‘(\[][ ]* )       # or of inserted subphrase...
6805
-                      ( ' . $smallWordsRx . ' ) \b # ...followed by small word
6805
+                      ( ' . $smallWordsRx.' ) \b # ...followed by small word
6806 6806
                      ~uxi',
6807
-        function ($matches) use ($encoding) {
6808
-          return $matches[1] . static::str_upper_first($matches[2], $encoding);
6807
+        function($matches) use ($encoding) {
6808
+          return $matches[1].static::str_upper_first($matches[2], $encoding);
6809 6809
         },
6810 6810
         $str
6811 6811
     );
6812 6812
 
6813 6813
     // ...and end of title
6814 6814
     $str = (string)\preg_replace_callback(
6815
-        '~\b ( ' . $smallWordsRx . ' ) # small word...
6815
+        '~\b ( '.$smallWordsRx.' ) # small word...
6816 6816
                       (?= [[:punct:]]* \Z     # ...at the end of the title...
6817 6817
                       |   [\'"’”)\]] [ ] )    # ...or of an inserted subphrase?
6818 6818
                      ~uxi',
6819
-        function ($matches) use ($encoding) {
6819
+        function($matches) use ($encoding) {
6820 6820
           return static::str_upper_first($matches[1], $encoding);
6821 6821
         },
6822 6822
         $str
@@ -6827,10 +6827,10 @@  discard block
 block discarded – undo
6827 6827
     $str = (string)\preg_replace_callback(
6828 6828
         '~\b
6829 6829
                         (?<! -)                   # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight)
6830
-                        ( ' . $smallWordsRx . ' )
6830
+                        ( ' . $smallWordsRx.' )
6831 6831
                         (?= -[[:alpha:]]+)        # lookahead for "-someword"
6832 6832
                        ~uxi',
6833
-        function ($matches) use ($encoding) {
6833
+        function($matches) use ($encoding) {
6834 6834
           return static::str_upper_first($matches[1], $encoding);
6835 6835
         },
6836 6836
         $str
@@ -6841,11 +6841,11 @@  discard block
 block discarded – undo
6841 6841
         '~\b
6842 6842
                       (?<!…)                    # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in)
6843 6843
                       ( [[:alpha:]]+- )         # $1 = first word and hyphen, should already be properly capped
6844
-                      ( ' . $smallWordsRx . ' ) # ...followed by small word
6844
+                      ( ' . $smallWordsRx.' ) # ...followed by small word
6845 6845
                       (?!	- )                   # Negative lookahead for another -
6846 6846
                      ~uxi',
6847
-        function ($matches) use ($encoding) {
6848
-          return $matches[1] . static::str_upper_first($matches[2], $encoding);
6847
+        function($matches) use ($encoding) {
6848
+          return $matches[1].static::str_upper_first($matches[2], $encoding);
6849 6849
         },
6850 6850
         $str
6851 6851
     );
@@ -6995,7 +6995,7 @@  discard block
 block discarded – undo
6995 6995
 
6996 6996
     $truncated = self::substr($str, 0, $length, $encoding);
6997 6997
 
6998
-    return $truncated . $substring;
6998
+    return $truncated.$substring;
6999 6999
   }
7000 7000
 
7001 7001
   /**
@@ -7037,7 +7037,7 @@  discard block
 block discarded – undo
7037 7037
       }
7038 7038
     }
7039 7039
 
7040
-    $str = $truncated . $substring;
7040
+    $str = $truncated.$substring;
7041 7041
 
7042 7042
     return $str;
7043 7043
   }
@@ -7182,7 +7182,7 @@  discard block
 block discarded – undo
7182 7182
   public static function strcmp(string $str1, string $str2): int
7183 7183
   {
7184 7184
     /** @noinspection PhpUndefinedClassInspection */
7185
-    return $str1 . '' === $str2 . '' ? 0 : \strcmp(
7185
+    return $str1.'' === $str2.'' ? 0 : \strcmp(
7186 7186
         \Normalizer::normalize($str1, \Normalizer::NFD),
7187 7187
         \Normalizer::normalize($str2, \Normalizer::NFD)
7188 7188
     );
@@ -7216,7 +7216,7 @@  discard block
 block discarded – undo
7216 7216
       return null;
7217 7217
     }
7218 7218
 
7219
-    if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) {
7219
+    if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) {
7220 7220
       return self::strlen($length[1]);
7221 7221
     }
7222 7222
 
@@ -7453,7 +7453,7 @@  discard block
 block discarded – undo
7453 7453
         &&
7454 7454
         self::$SUPPORT['mbstring'] === false
7455 7455
     ) {
7456
-      \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7456
+      \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7457 7457
     }
7458 7458
 
7459 7459
     if (self::$SUPPORT['mbstring'] === true) {
@@ -7475,7 +7475,7 @@  discard block
 block discarded – undo
7475 7475
       return \stristr($haystack, $needle, $before_needle);
7476 7476
     }
7477 7477
 
7478
-    \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match);
7478
+    \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match);
7479 7479
 
7480 7480
     if (!isset($match[1])) {
7481 7481
       return false;
@@ -7534,7 +7534,7 @@  discard block
 block discarded – undo
7534 7534
         &&
7535 7535
         self::$SUPPORT['iconv'] === false
7536 7536
     ) {
7537
-      \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7537
+      \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7538 7538
     }
7539 7539
 
7540 7540
     if (
@@ -7734,7 +7734,7 @@  discard block
 block discarded – undo
7734 7734
    */
7735 7735
   public static function strnatcmp(string $str1, string $str2): int
7736 7736
   {
7737
-    return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
7737
+    return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
7738 7738
   }
7739 7739
 
7740 7740
   /**
@@ -7794,7 +7794,7 @@  discard block
 block discarded – undo
7794 7794
       return false;
7795 7795
     }
7796 7796
 
7797
-    if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) {
7797
+    if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) {
7798 7798
       return \substr($haystack, (int)\strpos($haystack, $m[0]));
7799 7799
     }
7800 7800
 
@@ -7862,7 +7862,7 @@  discard block
 block discarded – undo
7862 7862
         &&
7863 7863
         self::$SUPPORT['mbstring'] === false
7864 7864
     ) {
7865
-      \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7865
+      \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7866 7866
     }
7867 7867
 
7868 7868
     if (
@@ -7995,7 +7995,7 @@  discard block
 block discarded – undo
7995 7995
         &&
7996 7996
         self::$SUPPORT['mbstring'] === false
7997 7997
     ) {
7998
-      \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7998
+      \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7999 7999
     }
8000 8000
 
8001 8001
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8142,7 +8142,7 @@  discard block
 block discarded – undo
8142 8142
         &&
8143 8143
         self::$SUPPORT['mbstring'] === false
8144 8144
     ) {
8145
-      \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8145
+      \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8146 8146
     }
8147 8147
 
8148 8148
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8233,7 +8233,7 @@  discard block
 block discarded – undo
8233 8233
         &&
8234 8234
         self::$SUPPORT['mbstring'] === false
8235 8235
     ) {
8236
-      \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8236
+      \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8237 8237
     }
8238 8238
 
8239 8239
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8321,7 +8321,7 @@  discard block
 block discarded – undo
8321 8321
       return 0;
8322 8322
     }
8323 8323
 
8324
-    return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0;
8324
+    return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0;
8325 8325
   }
8326 8326
 
8327 8327
   /**
@@ -8365,7 +8365,7 @@  discard block
 block discarded – undo
8365 8365
         &&
8366 8366
         self::$SUPPORT['mbstring'] === false
8367 8367
     ) {
8368
-      \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8368
+      \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8369 8369
     }
8370 8370
 
8371 8371
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8383,7 +8383,7 @@  discard block
 block discarded – undo
8383 8383
       }
8384 8384
     }
8385 8385
 
8386
-    \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match);
8386
+    \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match);
8387 8387
 
8388 8388
     if (!isset($match[1])) {
8389 8389
       return false;
@@ -8488,9 +8488,9 @@  discard block
 block discarded – undo
8488 8488
 
8489 8489
       if (self::$SUPPORT['intl'] === true) {
8490 8490
 
8491
-        $langCode = $lang . '-Lower';
8491
+        $langCode = $lang.'-Lower';
8492 8492
         if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
8493
-          \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, E_USER_WARNING);
8493
+          \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, E_USER_WARNING);
8494 8494
 
8495 8495
           $langCode = 'Any-Lower';
8496 8496
         }
@@ -8499,7 +8499,7 @@  discard block
 block discarded – undo
8499 8499
         return transliterator_transliterate($langCode, $str);
8500 8500
       }
8501 8501
 
8502
-      \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, E_USER_WARNING);
8502
+      \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, E_USER_WARNING);
8503 8503
     }
8504 8504
 
8505 8505
     // always fallback via symfony polyfill
@@ -8564,9 +8564,9 @@  discard block
 block discarded – undo
8564 8564
 
8565 8565
       if (self::$SUPPORT['intl'] === true) {
8566 8566
 
8567
-        $langCode = $lang . '-Upper';
8567
+        $langCode = $lang.'-Upper';
8568 8568
         if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
8569
-          \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, E_USER_WARNING);
8569
+          \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, E_USER_WARNING);
8570 8570
 
8571 8571
           $langCode = 'Any-Upper';
8572 8572
         }
@@ -8575,7 +8575,7 @@  discard block
 block discarded – undo
8575 8575
         return transliterator_transliterate($langCode, $str);
8576 8576
       }
8577 8577
 
8578
-      \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING);
8578
+      \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING);
8579 8579
     }
8580 8580
 
8581 8581
     // always fallback via symfony polyfill
@@ -8737,7 +8737,7 @@  discard block
 block discarded – undo
8737 8737
         &&
8738 8738
         self::$SUPPORT['mbstring'] === false
8739 8739
     ) {
8740
-      \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8740
+      \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8741 8741
     }
8742 8742
 
8743 8743
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8913,14 +8913,14 @@  discard block
 block discarded – undo
8913 8913
         &&
8914 8914
         self::$SUPPORT['mbstring'] === false
8915 8915
     ) {
8916
-      \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8916
+      \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8917 8917
     }
8918 8918
 
8919 8919
     if (self::$SUPPORT['mbstring'] === true) {
8920 8920
       return \mb_substr_count($haystack, $needle, $encoding);
8921 8921
     }
8922 8922
 
8923
-    \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER);
8923
+    \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER);
8924 8924
 
8925 8925
     return \count($matches);
8926 8926
   }
@@ -9231,8 +9231,7 @@  discard block
 block discarded – undo
9231 9231
 
9232 9232
     if (self::is_ascii($str)) {
9233 9233
       return ($length === null) ?
9234
-          \substr_replace($str, $replacement, $offset) :
9235
-          \substr_replace($str, $replacement, $offset, $length);
9234
+          \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length);
9236 9235
     }
9237 9236
 
9238 9237
     \preg_match_all('/./us', $str, $smatches);
@@ -9718,7 +9717,7 @@  discard block
 block discarded – undo
9718 9717
           $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1];
9719 9718
 
9720 9719
           if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already
9721
-            $buf .= $c1 . $c2;
9720
+            $buf .= $c1.$c2;
9722 9721
             $i++;
9723 9722
           } else { // not valid UTF8 - convert it
9724 9723
             $buf .= self::to_utf8_convert_helper($c1);
@@ -9730,7 +9729,7 @@  discard block
 block discarded – undo
9730 9729
           $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2];
9731 9730
 
9732 9731
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already
9733
-            $buf .= $c1 . $c2 . $c3;
9732
+            $buf .= $c1.$c2.$c3;
9734 9733
             $i += 2;
9735 9734
           } else { // not valid UTF8 - convert it
9736 9735
             $buf .= self::to_utf8_convert_helper($c1);
@@ -9743,7 +9742,7 @@  discard block
 block discarded – undo
9743 9742
           $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3];
9744 9743
 
9745 9744
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already
9746
-            $buf .= $c1 . $c2 . $c3 . $c4;
9745
+            $buf .= $c1.$c2.$c3.$c4;
9747 9746
             $i += 3;
9748 9747
           } else { // not valid UTF8 - convert it
9749 9748
             $buf .= self::to_utf8_convert_helper($c1);
@@ -9765,7 +9764,7 @@  discard block
 block discarded – undo
9765 9764
     // decode unicode escape sequences
9766 9765
     $buf = \preg_replace_callback(
9767 9766
         '/\\\\u([0-9a-f]{4})/i',
9768
-        function ($match) {
9767
+        function($match) {
9769 9768
           // always fallback via symfony polyfill
9770 9769
           return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
9771 9770
         },
@@ -9808,7 +9807,7 @@  discard block
 block discarded – undo
9808 9807
     } else {
9809 9808
       $cc1 = self::$CHR[$ordC1 / 64] | "\xC0";
9810 9809
       $cc2 = ((string)$input & "\x3F") | "\x80";
9811
-      $buf .= $cc1 . $cc2;
9810
+      $buf .= $cc1.$cc2;
9812 9811
     }
9813 9812
 
9814 9813
     return $buf;
@@ -9872,7 +9871,7 @@  discard block
 block discarded – undo
9872 9871
         $cleanUtf8
9873 9872
     );
9874 9873
 
9875
-    return $strPartOne . $strPartTwo;
9874
+    return $strPartOne.$strPartTwo;
9876 9875
   }
9877 9876
 
9878 9877
   /**
@@ -9917,7 +9916,7 @@  discard block
 block discarded – undo
9917 9916
       $str = self::clean($str);
9918 9917
     }
9919 9918
 
9920
-    $usePhpDefaultFunctions = !(bool)($charlist . \implode('', $exceptions));
9919
+    $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions));
9921 9920
 
9922 9921
     if (
9923 9922
         $usePhpDefaultFunctions === true
@@ -10421,7 +10420,7 @@  discard block
 block discarded – undo
10421 10420
       return '';
10422 10421
     }
10423 10422
 
10424
-    \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches);
10423
+    \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches);
10425 10424
 
10426 10425
     if (
10427 10426
         !isset($matches[0])
@@ -10431,7 +10430,7 @@  discard block
 block discarded – undo
10431 10430
       return $str;
10432 10431
     }
10433 10432
 
10434
-    return self::rtrim($matches[0]) . $strAddOn;
10433
+    return self::rtrim($matches[0]).$strAddOn;
10435 10434
   }
10436 10435
 
10437 10436
   /**
@@ -10502,7 +10501,7 @@  discard block
 block discarded – undo
10502 10501
       $strReturn .= $break;
10503 10502
     }
10504 10503
 
10505
-    return $strReturn . \implode('', $chars);
10504
+    return $strReturn.\implode('', $chars);
10506 10505
   }
10507 10506
 
10508 10507
   /**
Please login to merge, or discard this patch.