@@ -192,7 +192,7 @@ public static function truncate(string $s, int $maxLen, string $append = "\u{202
192192 if ($ maxLen < 1 ) {
193193 return $ append ;
194194
195- } elseif ($ matches = self ::match ($ s , '#^.{1, ' . $ maxLen. '}(?=[\s\x00-/:-@\[-`{-~])#us ' )) {
195+ } elseif ($ matches = self ::match ($ s , '#^.{1, ' . $ maxLen . '}(?=[\s\x00-/:-@\[-`{-~])#us ' )) {
196196 return $ matches [0 ] . $ append ;
197197
198198 } else {
@@ -316,7 +316,7 @@ public static function length(string $s): int
316316 public static function trim (string $ s , string $ charlist = self ::TRIM_CHARACTERS ): string
317317 {
318318 $ charlist = preg_quote ($ charlist , '# ' );
319- return self ::replace ($ s , '#^[ ' . $ charlist. ']+|[ ' . $ charlist. ']+\z#u ' , '' );
319+ return self ::replace ($ s , '#^[ ' . $ charlist . ']+|[ ' . $ charlist . ']+\z#u ' , '' );
320320 }
321321
322322
@@ -403,7 +403,7 @@ private static function pos(string $haystack, string $needle, int $nth = 1)
403403 return 0 ;
404404 }
405405 $ pos = 0 ;
406- while (false !== ($ pos = strpos ($ haystack , $ needle , $ pos )) && --$ nth ) {
406+ while (($ pos = strpos ($ haystack , $ needle , $ pos )) !== false && --$ nth ) {
407407 $ pos ++;
408408 }
409409 } else {
@@ -412,7 +412,7 @@ private static function pos(string $haystack, string $needle, int $nth = 1)
412412 return $ len ;
413413 }
414414 $ pos = $ len - 1 ;
415- while (false !== ($ pos = strrpos ($ haystack , $ needle , $ pos - $ len )) && ++$ nth ) {
415+ while (($ pos = strrpos ($ haystack , $ needle , $ pos - $ len )) !== false && ++$ nth ) {
416416 $ pos --;
417417 }
418418 }
@@ -501,7 +501,7 @@ public static function pcre(string $func, array $args)
501501 });
502502
503503 if (($ code = preg_last_error ()) // run-time error, but preg_last_error & return code are liars
504- && ($ res === null || !in_array ($ func , ['preg_filter ' , 'preg_replace_callback ' , 'preg_replace ' ]))
504+ && ($ res === null || !in_array ($ func , ['preg_filter ' , 'preg_replace_callback ' , 'preg_replace ' ], true ))
505505 ) {
506506 throw new RegexpException (($ messages [$ code ] ?? 'Unknown error ' )
507507 . ' (pattern: ' . implode (' or ' , (array ) $ args [0 ]) . ') ' , $ code );
0 commit comments