From 75385511351ebaadb408e908ca381eea8543d29f Mon Sep 17 00:00:00 2001 From: Chris Reichel Date: Fri, 18 Oct 2024 09:09:34 +0200 Subject: [PATCH] fix ArrayHelper::map() for path strings o code style fixes --- framework/helpers/BaseStringHelper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/helpers/BaseStringHelper.php b/framework/helpers/BaseStringHelper.php index 48f23c93ab7..bcecca8485b 100644 --- a/framework/helpers/BaseStringHelper.php +++ b/framework/helpers/BaseStringHelper.php @@ -239,11 +239,12 @@ public static function contains($string, $needle, $caseSensitive = true) $needle = (string)$needle; if ($caseSensitive) { + // can be replaced with just the str_contains call when minimum supported PHP version is raised to 8.0 or higher if (function_exists('str_contains')) { return str_contains($string, $needle); } $encoding = Yii::$app ? Yii::$app->charset : 'UTF-8'; - return mb_strpos($string, $needle, 0, $encoding) !== false; + return mb_strpos($string, $needle, 0, $encoding) !== false; } $encoding = Yii::$app ? Yii::$app->charset : 'UTF-8'; return mb_stripos($string, $needle, 0, $encoding) !== false;