Passed
Push — master ( 2b7dc8...9b52b9 )
by Lars
03:48
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);
@@ -3507,7 +3507,7 @@  discard block
 block discarded – undo
3507 3507
         $cleanUtf8
3508 3508
     );
3509 3509
 
3510
-    return $strPartOne . $strPartTwo;
3510
+    return $strPartOne.$strPartTwo;
3511 3511
   }
3512 3512
 
3513 3513
   /**
@@ -3974,7 +3974,7 @@  discard block
 block discarded – undo
3974 3974
       }
3975 3975
     }
3976 3976
 
3977
-    $cacheKey = $chr_orig . $encoding;
3977
+    $cacheKey = $chr_orig.$encoding;
3978 3978
     if (isset($CHAR_CACHE[$cacheKey]) === true) {
3979 3979
       return $CHAR_CACHE[$cacheKey];
3980 3980
     }
@@ -4216,7 +4216,7 @@  discard block
 block discarded – undo
4216 4216
     }
4217 4217
 
4218 4218
     $str = (string)\preg_replace(
4219
-        $delimiter . $pattern . $delimiter . 'u' . $options,
4219
+        $delimiter.$pattern.$delimiter.'u'.$options,
4220 4220
         $replacement,
4221 4221
         $str
4222 4222
     );
@@ -4287,7 +4287,7 @@  discard block
 block discarded – undo
4287 4287
     if (\is_array($what) === true) {
4288 4288
       /** @noinspection ForeachSourceInspection */
4289 4289
       foreach ($what as $item) {
4290
-        $str = (string)\preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str);
4290
+        $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str);
4291 4291
       }
4292 4292
     }
4293 4293
 
@@ -4535,7 +4535,7 @@  discard block
 block discarded – undo
4535 4535
   {
4536 4536
     static $RX_CLASSS_CACHE = [];
4537 4537
 
4538
-    $cacheKey = $s . $class;
4538
+    $cacheKey = $s.$class;
4539 4539
 
4540 4540
     if (isset($RX_CLASSS_CACHE[$cacheKey])) {
4541 4541
       return $RX_CLASSS_CACHE[$cacheKey];
@@ -4547,7 +4547,7 @@  discard block
 block discarded – undo
4547 4547
     /** @noinspection SuspiciousLoopInspection */
4548 4548
     foreach (self::str_split($s) as $s) {
4549 4549
       if ('-' === $s) {
4550
-        $class[0] = '-' . $class[0];
4550
+        $class[0] = '-'.$class[0];
4551 4551
       } elseif (!isset($s[2])) {
4552 4552
         $class[0] .= \preg_quote($s, '/');
4553 4553
       } elseif (1 === self::strlen($s)) {
@@ -4558,13 +4558,13 @@  discard block
 block discarded – undo
4558 4558
     }
4559 4559
 
4560 4560
     if ($class[0]) {
4561
-      $class[0] = '[' . $class[0] . ']';
4561
+      $class[0] = '['.$class[0].']';
4562 4562
     }
4563 4563
 
4564 4564
     if (1 === \count($class)) {
4565 4565
       $return = $class[0];
4566 4566
     } else {
4567
-      $return = '(?:' . \implode('|', $class) . ')';
4567
+      $return = '(?:'.\implode('|', $class).')';
4568 4568
     }
4569 4569
 
4570 4570
     $RX_CLASSS_CACHE[$cacheKey] = $return;
@@ -4583,7 +4583,7 @@  discard block
 block discarded – undo
4583 4583
 
4584 4584
     echo '<pre>';
4585 4585
     foreach (self::$SUPPORT as $key => $value) {
4586
-      echo $key . ' - ' . \print_r($value, true) . "\n<br>";
4586
+      echo $key.' - '.\print_r($value, true)."\n<br>";
4587 4587
     }
4588 4588
     echo '</pre>';
4589 4589
   }
@@ -4615,7 +4615,7 @@  discard block
 block discarded – undo
4615 4615
       $encoding = self::normalize_encoding($encoding, 'UTF-8');
4616 4616
     }
4617 4617
 
4618
-    return '&#' . self::ord($char, $encoding) . ';';
4618
+    return '&#'.self::ord($char, $encoding).';';
4619 4619
   }
4620 4620
 
4621 4621
   /**
@@ -4690,7 +4690,7 @@  discard block
 block discarded – undo
4690 4690
         ) {
4691 4691
 
4692 4692
           if (($str[$i + 1] & "\xC0") === "\x80") {
4693
-            $ret[] = $str[$i] . $str[$i + 1];
4693
+            $ret[] = $str[$i].$str[$i + 1];
4694 4694
 
4695 4695
             $i++;
4696 4696
           }
@@ -4706,7 +4706,7 @@  discard block
 block discarded – undo
4706 4706
               &&
4707 4707
               ($str[$i + 2] & "\xC0") === "\x80"
4708 4708
           ) {
4709
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2];
4709
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2];
4710 4710
 
4711 4711
             $i += 2;
4712 4712
           }
@@ -4724,7 +4724,7 @@  discard block
 block discarded – undo
4724 4724
               &&
4725 4725
               ($str[$i + 3] & "\xC0") === "\x80"
4726 4726
           ) {
4727
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3];
4727
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3];
4728 4728
 
4729 4729
             $i += 3;
4730 4730
           }
@@ -4737,7 +4737,7 @@  discard block
 block discarded – undo
4737 4737
       $ret = \array_chunk($ret, $length);
4738 4738
 
4739 4739
       return \array_map(
4740
-          function ($item) {
4740
+          function($item) {
4741 4741
             return \implode('', $item);
4742 4742
           }, $ret
4743 4743
       );
@@ -4767,7 +4767,7 @@  discard block
 block discarded – undo
4767 4767
 
4768 4768
     $str = (string)\preg_replace_callback(
4769 4769
         '/[-_\s]+(.)?/u',
4770
-        function ($match) use ($encoding) {
4770
+        function($match) use ($encoding) {
4771 4771
           if (isset($match[1])) {
4772 4772
             return UTF8::strtoupper($match[1], $encoding);
4773 4773
           }
@@ -4779,7 +4779,7 @@  discard block
 block discarded – undo
4779 4779
 
4780 4780
     $str = (string)\preg_replace_callback(
4781 4781
         '/[\d]+(.)?/u',
4782
-        function ($match) use ($encoding) {
4782
+        function($match) use ($encoding) {
4783 4783
           return UTF8::strtoupper($match[0], $encoding);
4784 4784
         },
4785 4785
         $str
@@ -5141,7 +5141,7 @@  discard block
 block discarded – undo
5141 5141
     foreach (self::$ENCODINGS as $encodingTmp) {
5142 5142
       # INFO: //IGNORE but still throw notice
5143 5143
       /** @noinspection PhpUsageOfSilenceOperatorInspection */
5144
-      if (\md5((string)@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) {
5144
+      if (\md5((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) {
5145 5145
         return $encodingTmp;
5146 5146
       }
5147 5147
     }
@@ -5203,7 +5203,7 @@  discard block
 block discarded – undo
5203 5203
   public static function str_ensure_left(string $str, string $substring): string
5204 5204
   {
5205 5205
     if (!self::str_starts_with($str, $substring)) {
5206
-      $str = $substring . $str;
5206
+      $str = $substring.$str;
5207 5207
     }
5208 5208
 
5209 5209
     return $str;
@@ -5412,7 +5412,7 @@  discard block
 block discarded – undo
5412 5412
     $start = self::substr($str, 0, $index, $encoding);
5413 5413
     $end = self::substr($str, $index, $len, $encoding);
5414 5414
 
5415
-    return $start . $substring . $end;
5415
+    return $start.$substring.$end;
5416 5416
   }
5417 5417
 
5418 5418
   /**
@@ -5449,7 +5449,7 @@  discard block
 block discarded – undo
5449 5449
       if ('' === $s .= '') {
5450 5450
         $s = '/^(?<=.)$/';
5451 5451
       } else {
5452
-        $s = '/' . \preg_quote($s, '/') . '/ui';
5452
+        $s = '/'.\preg_quote($s, '/').'/ui';
5453 5453
       }
5454 5454
     }
5455 5455
 
@@ -5732,7 +5732,7 @@  discard block
 block discarded – undo
5732 5732
       return $str;
5733 5733
     }
5734 5734
 
5735
-    return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding) . $strAddOn;
5735
+    return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding).$strAddOn;
5736 5736
   }
5737 5737
 
5738 5738
   /**
@@ -5760,7 +5760,7 @@  discard block
 block discarded – undo
5760 5760
     }
5761 5761
 
5762 5762
     if (self::substr($str, $length - 1, 1, $encoding) === ' ') {
5763
-      return self::substr($str, 0, $length - 1, $encoding) . $strAddOn;
5763
+      return self::substr($str, 0, $length - 1, $encoding).$strAddOn;
5764 5764
     }
5765 5765
 
5766 5766
     $str = (string)self::substr($str, 0, $length, $encoding);
@@ -5769,9 +5769,9 @@  discard block
 block discarded – undo
5769 5769
     $new_str = \implode(' ', $array);
5770 5770
 
5771 5771
     if ($new_str === '') {
5772
-      $str = self::substr($str, 0, $length - 1, $encoding) . $strAddOn;
5772
+      $str = self::substr($str, 0, $length - 1, $encoding).$strAddOn;
5773 5773
     } else {
5774
-      $str = $new_str . $strAddOn;
5774
+      $str = $new_str.$strAddOn;
5775 5775
     }
5776 5776
 
5777 5777
     return $str;
@@ -5874,7 +5874,7 @@  discard block
 block discarded – undo
5874 5874
       $char = self::substr($str, -$i, 1, $encoding);
5875 5875
 
5876 5876
       if ($char == self::substr($otherStr, -$i, 1, $encoding)) {
5877
-        $longestCommonSuffix = $char . $longestCommonSuffix;
5877
+        $longestCommonSuffix = $char.$longestCommonSuffix;
5878 5878
       } else {
5879 5879
         break;
5880 5880
       }
@@ -5893,7 +5893,7 @@  discard block
 block discarded – undo
5893 5893
    */
5894 5894
   public static function str_matches_pattern(string $str, string $pattern): bool
5895 5895
   {
5896
-    if (\preg_match('/' . $pattern . '/u', $str)) {
5896
+    if (\preg_match('/'.$pattern.'/u', $str)) {
5897 5897
       return true;
5898 5898
     }
5899 5899
 
@@ -5983,7 +5983,7 @@  discard block
 block discarded – undo
5983 5983
         $pad_type = STR_PAD_BOTH;
5984 5984
       } else {
5985 5985
         throw new \InvalidArgumentException(
5986
-            'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'"
5986
+            'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'"
5987 5987
         );
5988 5988
       }
5989 5989
     }
@@ -6020,7 +6020,7 @@  discard block
 block discarded – undo
6020 6020
           $pre = '';
6021 6021
       }
6022 6022
 
6023
-      return $pre . $str . $post;
6023
+      return $pre.$str.$post;
6024 6024
     }
6025 6025
 
6026 6026
     return $str;
@@ -6148,7 +6148,7 @@  discard block
 block discarded – undo
6148 6148
   {
6149 6149
     return self::regex_replace(
6150 6150
         $str,
6151
-        '^' . \preg_quote($search, '/'),
6151
+        '^'.\preg_quote($search, '/'),
6152 6152
         self::str_replace('\\', '\\\\', $replacement)
6153 6153
     );
6154 6154
   }
@@ -6166,7 +6166,7 @@  discard block
 block discarded – undo
6166 6166
   {
6167 6167
     return self::regex_replace(
6168 6168
         $str,
6169
-        \preg_quote($search, '/') . '$',
6169
+        \preg_quote($search, '/').'$',
6170 6170
         self::str_replace('\\', '\\\\', $replacement)
6171 6171
     );
6172 6172
   }
@@ -6279,24 +6279,24 @@  discard block
 block discarded – undo
6279 6279
 
6280 6280
     $str = (string)\preg_replace_callback(
6281 6281
         '/([\d|A-Z])/u',
6282
-        function ($matches) use ($encoding) {
6282
+        function($matches) use ($encoding) {
6283 6283
           $match = $matches[1];
6284 6284
           $matchInt = (int)$match;
6285 6285
 
6286 6286
           if ((string)$matchInt == $match) {
6287
-            return '_' . $match . '_';
6287
+            return '_'.$match.'_';
6288 6288
           }
6289 6289
 
6290
-          return '_' . UTF8::strtolower($match, $encoding);
6290
+          return '_'.UTF8::strtolower($match, $encoding);
6291 6291
         },
6292 6292
         $str
6293 6293
     );
6294 6294
 
6295 6295
     $str = (string)\preg_replace(
6296 6296
         [
6297
-            '/\s+/',        // convert spaces to "_"
6298
-            '/^\s+|\s+$/',  // trim leading & trailing spaces
6299
-            '/_+/',         // remove double "_"
6297
+            '/\s+/', // convert spaces to "_"
6298
+            '/^\s+|\s+$/', // trim leading & trailing spaces
6299
+            '/_+/', // remove double "_"
6300 6300
         ],
6301 6301
         [
6302 6302
             '_',
@@ -6365,7 +6365,7 @@  discard block
 block discarded – undo
6365 6365
     }
6366 6366
 
6367 6367
     /** @noinspection NotOptimalRegularExpressionsInspection */
6368
-    \preg_match_all('/' . self::GRAPHEME_CLUSTER_RX . '/u', $str, $a);
6368
+    \preg_match_all('/'.self::GRAPHEME_CLUSTER_RX.'/u', $str, $a);
6369 6369
     $a = $a[0];
6370 6370
 
6371 6371
     if ($len === 1) {
@@ -6418,7 +6418,7 @@  discard block
 block discarded – undo
6418 6418
       $limit = -1;
6419 6419
     }
6420 6420
 
6421
-    $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit);
6421
+    $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit);
6422 6422
 
6423 6423
     if ($array === false) {
6424 6424
       return [];
@@ -6700,7 +6700,7 @@  discard block
 block discarded – undo
6700 6700
 
6701 6701
     $str = (string)\preg_replace_callback(
6702 6702
         '/([\S]+)/u',
6703
-        function ($match) use ($encoding, $ignore) {
6703
+        function($match) use ($encoding, $ignore) {
6704 6704
           if ($ignore && \in_array($match[0], $ignore, true)) {
6705 6705
             return $match[0];
6706 6706
           }
@@ -6769,16 +6769,16 @@  discard block
 block discarded – undo
6769 6769
     $str = (string)\preg_replace_callback(
6770 6770
         '~\b (_*) (?:                                                              # 1. Leading underscore and
6771 6771
                         ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ |              # 2. file path or 
6772
-                          [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) #    URL, domain, or email
6772
+                          [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) #    URL, domain, or email
6773 6773
                         |
6774
-                        ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' )            # 3. or small word (case-insensitive)
6774
+                        ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' )            # 3. or small word (case-insensitive)
6775 6775
                         |
6776
-                        ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' )     # 4. or word w/o internal caps
6776
+                        ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' )     # 4. or word w/o internal caps
6777 6777
                         |
6778
-                        ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' )     # 5. or some other word
6778
+                        ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' )     # 5. or some other word
6779 6779
                       ) (_*) \b                                                           # 6. With trailing underscore
6780 6780
                     ~ux',
6781
-        function ($matches) use ($encoding) {
6781
+        function($matches) use ($encoding) {
6782 6782
           // Preserve leading underscore
6783 6783
           $str = $matches[1];
6784 6784
           if ($matches[2]) {
@@ -6807,21 +6807,21 @@  discard block
 block discarded – undo
6807 6807
         '~(  \A [[:punct:]]*                # start of title...
6808 6808
                       |  [:.;?!][ ]+               # or of subsentence...
6809 6809
                       |  [ ][\'"“‘(\[][ ]* )       # or of inserted subphrase...
6810
-                      ( ' . $smallWordsRx . ' ) \b # ...followed by small word
6810
+                      ( ' . $smallWordsRx.' ) \b # ...followed by small word
6811 6811
                      ~uxi',
6812
-        function ($matches) use ($encoding) {
6813
-          return $matches[1] . static::str_upper_first($matches[2], $encoding);
6812
+        function($matches) use ($encoding) {
6813
+          return $matches[1].static::str_upper_first($matches[2], $encoding);
6814 6814
         },
6815 6815
         $str
6816 6816
     );
6817 6817
 
6818 6818
     // ...and end of title
6819 6819
     $str = (string)\preg_replace_callback(
6820
-        '~\b ( ' . $smallWordsRx . ' ) # small word...
6820
+        '~\b ( '.$smallWordsRx.' ) # small word...
6821 6821
                       (?= [[:punct:]]* \Z     # ...at the end of the title...
6822 6822
                       |   [\'"’”)\]] [ ] )    # ...or of an inserted subphrase?
6823 6823
                      ~uxi',
6824
-        function ($matches) use ($encoding) {
6824
+        function($matches) use ($encoding) {
6825 6825
           return static::str_upper_first($matches[1], $encoding);
6826 6826
         },
6827 6827
         $str
@@ -6832,10 +6832,10 @@  discard block
 block discarded – undo
6832 6832
     $str = (string)\preg_replace_callback(
6833 6833
         '~\b
6834 6834
                         (?<! -)                   # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight)
6835
-                        ( ' . $smallWordsRx . ' )
6835
+                        ( ' . $smallWordsRx.' )
6836 6836
                         (?= -[[:alpha:]]+)        # lookahead for "-someword"
6837 6837
                        ~uxi',
6838
-        function ($matches) use ($encoding) {
6838
+        function($matches) use ($encoding) {
6839 6839
           return static::str_upper_first($matches[1], $encoding);
6840 6840
         },
6841 6841
         $str
@@ -6846,11 +6846,11 @@  discard block
 block discarded – undo
6846 6846
         '~\b
6847 6847
                       (?<!…)                    # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in)
6848 6848
                       ( [[:alpha:]]+- )         # $1 = first word and hyphen, should already be properly capped
6849
-                      ( ' . $smallWordsRx . ' ) # ...followed by small word
6849
+                      ( ' . $smallWordsRx.' ) # ...followed by small word
6850 6850
                       (?!	- )                   # Negative lookahead for another -
6851 6851
                      ~uxi',
6852
-        function ($matches) use ($encoding) {
6853
-          return $matches[1] . static::str_upper_first($matches[2], $encoding);
6852
+        function($matches) use ($encoding) {
6853
+          return $matches[1].static::str_upper_first($matches[2], $encoding);
6854 6854
         },
6855 6855
         $str
6856 6856
     );
@@ -7000,7 +7000,7 @@  discard block
 block discarded – undo
7000 7000
 
7001 7001
     $truncated = self::substr($str, 0, $length, $encoding);
7002 7002
 
7003
-    return $truncated . $substring;
7003
+    return $truncated.$substring;
7004 7004
   }
7005 7005
 
7006 7006
   /**
@@ -7042,7 +7042,7 @@  discard block
 block discarded – undo
7042 7042
       }
7043 7043
     }
7044 7044
 
7045
-    $str = $truncated . $substring;
7045
+    $str = $truncated.$substring;
7046 7046
 
7047 7047
     return $str;
7048 7048
   }
@@ -7187,7 +7187,7 @@  discard block
 block discarded – undo
7187 7187
   public static function strcmp(string $str1, string $str2): int
7188 7188
   {
7189 7189
     /** @noinspection PhpUndefinedClassInspection */
7190
-    return $str1 . '' === $str2 . '' ? 0 : \strcmp(
7190
+    return $str1.'' === $str2.'' ? 0 : \strcmp(
7191 7191
         \Normalizer::normalize($str1, \Normalizer::NFD),
7192 7192
         \Normalizer::normalize($str2, \Normalizer::NFD)
7193 7193
     );
@@ -7221,7 +7221,7 @@  discard block
 block discarded – undo
7221 7221
       return null;
7222 7222
     }
7223 7223
 
7224
-    if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) {
7224
+    if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) {
7225 7225
       return self::strlen($length[1]);
7226 7226
     }
7227 7227
 
@@ -7458,7 +7458,7 @@  discard block
 block discarded – undo
7458 7458
         &&
7459 7459
         self::$SUPPORT['mbstring'] === false
7460 7460
     ) {
7461
-      \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7461
+      \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7462 7462
     }
7463 7463
 
7464 7464
     if (self::$SUPPORT['mbstring'] === true) {
@@ -7480,7 +7480,7 @@  discard block
 block discarded – undo
7480 7480
       return \stristr($haystack, $needle, $before_needle);
7481 7481
     }
7482 7482
 
7483
-    \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match);
7483
+    \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match);
7484 7484
 
7485 7485
     if (!isset($match[1])) {
7486 7486
       return false;
@@ -7539,7 +7539,7 @@  discard block
 block discarded – undo
7539 7539
         &&
7540 7540
         self::$SUPPORT['iconv'] === false
7541 7541
     ) {
7542
-      \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7542
+      \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7543 7543
     }
7544 7544
 
7545 7545
     if (
@@ -7663,7 +7663,7 @@  discard block
 block discarded – undo
7663 7663
    */
7664 7664
   public static function strnatcmp(string $str1, string $str2): int
7665 7665
   {
7666
-    return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
7666
+    return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
7667 7667
   }
7668 7668
 
7669 7669
   /**
@@ -7723,7 +7723,7 @@  discard block
 block discarded – undo
7723 7723
       return false;
7724 7724
     }
7725 7725
 
7726
-    if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) {
7726
+    if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) {
7727 7727
       return \substr($haystack, (int)\strpos($haystack, $m[0]));
7728 7728
     }
7729 7729
 
@@ -7791,7 +7791,7 @@  discard block
 block discarded – undo
7791 7791
         &&
7792 7792
         self::$SUPPORT['mbstring'] === false
7793 7793
     ) {
7794
-      \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7794
+      \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7795 7795
     }
7796 7796
 
7797 7797
     if (
@@ -7924,7 +7924,7 @@  discard block
 block discarded – undo
7924 7924
         &&
7925 7925
         self::$SUPPORT['mbstring'] === false
7926 7926
     ) {
7927
-      \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7927
+      \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7928 7928
     }
7929 7929
 
7930 7930
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8071,7 +8071,7 @@  discard block
 block discarded – undo
8071 8071
         &&
8072 8072
         self::$SUPPORT['mbstring'] === false
8073 8073
     ) {
8074
-      \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8074
+      \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8075 8075
     }
8076 8076
 
8077 8077
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8162,7 +8162,7 @@  discard block
 block discarded – undo
8162 8162
         &&
8163 8163
         self::$SUPPORT['mbstring'] === false
8164 8164
     ) {
8165
-      \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8165
+      \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8166 8166
     }
8167 8167
 
8168 8168
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8250,7 +8250,7 @@  discard block
 block discarded – undo
8250 8250
       return 0;
8251 8251
     }
8252 8252
 
8253
-    return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0;
8253
+    return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0;
8254 8254
   }
8255 8255
 
8256 8256
   /**
@@ -8294,7 +8294,7 @@  discard block
 block discarded – undo
8294 8294
         &&
8295 8295
         self::$SUPPORT['mbstring'] === false
8296 8296
     ) {
8297
-      \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8297
+      \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8298 8298
     }
8299 8299
 
8300 8300
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8312,7 +8312,7 @@  discard block
 block discarded – undo
8312 8312
       }
8313 8313
     }
8314 8314
 
8315
-    \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match);
8315
+    \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match);
8316 8316
 
8317 8317
     if (!isset($match[1])) {
8318 8318
       return false;
@@ -8417,9 +8417,9 @@  discard block
 block discarded – undo
8417 8417
 
8418 8418
       if (self::$SUPPORT['intl'] === true) {
8419 8419
 
8420
-        $langCode = $lang . '-Lower';
8420
+        $langCode = $lang.'-Lower';
8421 8421
         if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
8422
-          \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, E_USER_WARNING);
8422
+          \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, E_USER_WARNING);
8423 8423
 
8424 8424
           $langCode = 'Any-Lower';
8425 8425
         }
@@ -8428,7 +8428,7 @@  discard block
 block discarded – undo
8428 8428
         return transliterator_transliterate($langCode, $str);
8429 8429
       }
8430 8430
 
8431
-      \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, E_USER_WARNING);
8431
+      \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, E_USER_WARNING);
8432 8432
     }
8433 8433
 
8434 8434
     // always fallback via symfony polyfill
@@ -8493,9 +8493,9 @@  discard block
 block discarded – undo
8493 8493
 
8494 8494
       if (self::$SUPPORT['intl'] === true) {
8495 8495
 
8496
-        $langCode = $lang . '-Upper';
8496
+        $langCode = $lang.'-Upper';
8497 8497
         if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
8498
-          \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, E_USER_WARNING);
8498
+          \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, E_USER_WARNING);
8499 8499
 
8500 8500
           $langCode = 'Any-Upper';
8501 8501
         }
@@ -8504,7 +8504,7 @@  discard block
 block discarded – undo
8504 8504
         return transliterator_transliterate($langCode, $str);
8505 8505
       }
8506 8506
 
8507
-      \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING);
8507
+      \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING);
8508 8508
     }
8509 8509
 
8510 8510
     // always fallback via symfony polyfill
@@ -8666,7 +8666,7 @@  discard block
 block discarded – undo
8666 8666
         &&
8667 8667
         self::$SUPPORT['mbstring'] === false
8668 8668
     ) {
8669
-      \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8669
+      \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8670 8670
     }
8671 8671
 
8672 8672
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8842,14 +8842,14 @@  discard block
 block discarded – undo
8842 8842
         &&
8843 8843
         self::$SUPPORT['mbstring'] === false
8844 8844
     ) {
8845
-      \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8845
+      \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8846 8846
     }
8847 8847
 
8848 8848
     if (self::$SUPPORT['mbstring'] === true) {
8849 8849
       return \mb_substr_count($haystack, $needle, $encoding);
8850 8850
     }
8851 8851
 
8852
-    \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER);
8852
+    \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER);
8853 8853
 
8854 8854
     return \count($matches);
8855 8855
   }
@@ -9116,8 +9116,7 @@  discard block
 block discarded – undo
9116 9116
 
9117 9117
     if (self::is_ascii($str)) {
9118 9118
       return ($length === null) ?
9119
-          \substr_replace($str, $replacement, $offset) :
9120
-          \substr_replace($str, $replacement, $offset, $length);
9119
+          \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length);
9121 9120
     }
9122 9121
 
9123 9122
     \preg_match_all('/./us', $str, $smatches);
@@ -9603,7 +9602,7 @@  discard block
 block discarded – undo
9603 9602
           $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1];
9604 9603
 
9605 9604
           if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already
9606
-            $buf .= $c1 . $c2;
9605
+            $buf .= $c1.$c2;
9607 9606
             $i++;
9608 9607
           } else { // not valid UTF8 - convert it
9609 9608
             $buf .= self::to_utf8_convert_helper($c1);
@@ -9615,7 +9614,7 @@  discard block
 block discarded – undo
9615 9614
           $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2];
9616 9615
 
9617 9616
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already
9618
-            $buf .= $c1 . $c2 . $c3;
9617
+            $buf .= $c1.$c2.$c3;
9619 9618
             $i += 2;
9620 9619
           } else { // not valid UTF8 - convert it
9621 9620
             $buf .= self::to_utf8_convert_helper($c1);
@@ -9628,7 +9627,7 @@  discard block
 block discarded – undo
9628 9627
           $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3];
9629 9628
 
9630 9629
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already
9631
-            $buf .= $c1 . $c2 . $c3 . $c4;
9630
+            $buf .= $c1.$c2.$c3.$c4;
9632 9631
             $i += 3;
9633 9632
           } else { // not valid UTF8 - convert it
9634 9633
             $buf .= self::to_utf8_convert_helper($c1);
@@ -9650,7 +9649,7 @@  discard block
 block discarded – undo
9650 9649
     // decode unicode escape sequences
9651 9650
     $buf = \preg_replace_callback(
9652 9651
         '/\\\\u([0-9a-f]{4})/i',
9653
-        function ($match) {
9652
+        function($match) {
9654 9653
           // always fallback via symfony polyfill
9655 9654
           return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
9656 9655
         },
@@ -9693,7 +9692,7 @@  discard block
 block discarded – undo
9693 9692
     } else {
9694 9693
       $cc1 = self::$CHR[$ordC1 / 64] | "\xC0";
9695 9694
       $cc2 = ((string)$input & "\x3F") | "\x80";
9696
-      $buf .= $cc1 . $cc2;
9695
+      $buf .= $cc1.$cc2;
9697 9696
     }
9698 9697
 
9699 9698
     return $buf;
@@ -9757,7 +9756,7 @@  discard block
 block discarded – undo
9757 9756
         $cleanUtf8
9758 9757
     );
9759 9758
 
9760
-    return $strPartOne . $strPartTwo;
9759
+    return $strPartOne.$strPartTwo;
9761 9760
   }
9762 9761
 
9763 9762
   /**
@@ -9802,7 +9801,7 @@  discard block
 block discarded – undo
9802 9801
       $str = self::clean($str);
9803 9802
     }
9804 9803
 
9805
-    $usePhpDefaultFunctions = !(bool)($charlist . \implode('', $exceptions));
9804
+    $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions));
9806 9805
 
9807 9806
     if (
9808 9807
         $usePhpDefaultFunctions === true
@@ -10306,7 +10305,7 @@  discard block
 block discarded – undo
10306 10305
       return '';
10307 10306
     }
10308 10307
 
10309
-    \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches);
10308
+    \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches);
10310 10309
 
10311 10310
     if (
10312 10311
         !isset($matches[0])
@@ -10316,7 +10315,7 @@  discard block
 block discarded – undo
10316 10315
       return $str;
10317 10316
     }
10318 10317
 
10319
-    return self::rtrim($matches[0]) . $strAddOn;
10318
+    return self::rtrim($matches[0]).$strAddOn;
10320 10319
   }
10321 10320
 
10322 10321
   /**
@@ -10387,7 +10386,7 @@  discard block
 block discarded – undo
10387 10386
       $strReturn .= $break;
10388 10387
     }
10389 10388
 
10390
-    return $strReturn . \implode('', $chars);
10389
+    return $strReturn.\implode('', $chars);
10391 10390
   }
10392 10391
 
10393 10392
   /**
Please login to merge, or discard this patch.