From: Tim Düsterhus Date: Wed, 22 Sep 2021 09:59:11 +0000 (+0200) Subject: Deprecate `StringUtil::(starts|ends)With()` X-Git-Tag: 5.5.0_Alpha_1~415^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7516dc712af2a595757e4709ecf9840394ae2e7e;p=GitHub%2FWoltLab%2FWCF.git Deprecate `StringUtil::(starts|ends)With()` `\str_starts_with()` and `\str_ends_with()` are both polyfilled by `symfony/polyfill-php80`. --- diff --git a/wcfsetup/install/files/lib/util/StringUtil.class.php b/wcfsetup/install/files/lib/util/StringUtil.class.php index 8682217790..674bd14c59 100644 --- a/wcfsetup/install/files/lib/util/StringUtil.class.php +++ b/wcfsetup/install/files/lib/util/StringUtil.class.php @@ -342,13 +342,7 @@ final class StringUtil } /** - * Checks whether $haystack starts with $needle, or not. - * - * @param string $haystack The string to be checked for starting with $needle - * @param string $needle The string to be found at the start of $haystack - * @param bool $ci Case insensitive or not. Default = false. - * - * @return bool True, if $haystack starts with $needle, false otherwise. + * @deprecated 5.5 Use \str_starts_with() instead. If a case-insensitive comparison is desired, manually call \mb_strtolower on both parameters. */ public static function startsWith($haystack, $needle, $ci = false) { @@ -361,12 +355,7 @@ final class StringUtil } /** - * Returns true if $haystack ends with $needle or if the length of $needle is 0. - * - * @param string $haystack - * @param string $needle - * @param bool $ci case insensitive - * @return bool + * @deprecated 5.5 Use \str_ends_with() instead. If a case-insensitive comparison is desired, manually call \mb_strtolower on both parameters. */ public static function endsWith($haystack, $needle, $ci = false) {