mirror of
https://github.com/yiisoft/yii2.git
synced 2025-10-31 02:28:35 +08:00
Merge branch 'master' into 20267-widget-end-resolved-classes
This commit is contained in:
@ -10,6 +10,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #20256: Add support for dropping views in MSSQL server when running migrate/fresh (ambrozt)
|
||||
- Enh #20248: Add support for attaching behaviors in configurations with Closure (timkelty)
|
||||
- Enh #20267: Fixed called class check in `Widget::end()` when widget configured using callable (rob006, jrajamaki)
|
||||
- Enh #20268: Minor optimisation in `\yii\helpers\BaseArrayHelper::map` (chriscpty)
|
||||
|
||||
2.0.51 July 18, 2024
|
||||
--------------------
|
||||
|
||||
@ -595,6 +595,9 @@ class BaseArrayHelper
|
||||
*/
|
||||
public static function map($array, $from, $to, $group = null)
|
||||
{
|
||||
if (is_string($from) && is_string($to) && $group === null && strpos($from, '.') === false && strpos($to, '.') === false) {
|
||||
return array_column($array, $to, $from);
|
||||
}
|
||||
$result = [];
|
||||
foreach ($array as $element) {
|
||||
$key = static::getValue($element, $from);
|
||||
|
||||
@ -313,9 +313,14 @@ class BaseStringHelper
|
||||
}
|
||||
if ($skipEmpty) {
|
||||
// Wrapped with array_values to make array keys sequential after empty values removing
|
||||
$result = array_values(array_filter($result, function ($value) {
|
||||
return $value !== '';
|
||||
}));
|
||||
$result = array_values(
|
||||
array_filter(
|
||||
$result,
|
||||
function ($value) {
|
||||
return $value !== '';
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -343,7 +348,7 @@ class BaseStringHelper
|
||||
*/
|
||||
public static function normalizeNumber($value)
|
||||
{
|
||||
$value = (string) $value;
|
||||
$value = (string)$value;
|
||||
|
||||
$localeInfo = localeconv();
|
||||
$decimalSeparator = isset($localeInfo['decimal_point']) ? $localeInfo['decimal_point'] : null;
|
||||
@ -396,7 +401,7 @@ class BaseStringHelper
|
||||
{
|
||||
// . and , are the only decimal separators known in ICU data,
|
||||
// so its safe to call str_replace here
|
||||
return str_replace(',', '.', (string) $number);
|
||||
return str_replace(',', '.', (string)$number);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -422,14 +427,14 @@ class BaseStringHelper
|
||||
|
||||
$replacements = [
|
||||
'\\\\\\\\' => '\\\\',
|
||||
'\\\\\\*' => '[*]',
|
||||
'\\\\\\?' => '[?]',
|
||||
'\*' => '.*',
|
||||
'\?' => '.',
|
||||
'\[\!' => '[^',
|
||||
'\[' => '[',
|
||||
'\]' => ']',
|
||||
'\-' => '-',
|
||||
'\\\\\\*' => '[*]',
|
||||
'\\\\\\?' => '[?]',
|
||||
'\*' => '.*',
|
||||
'\?' => '.',
|
||||
'\[\!' => '[^',
|
||||
'\[' => '[',
|
||||
'\]' => ']',
|
||||
'\-' => '-',
|
||||
];
|
||||
|
||||
if (isset($options['escape']) && !$options['escape']) {
|
||||
@ -483,7 +488,7 @@ class BaseStringHelper
|
||||
*/
|
||||
public static function mb_ucwords($string, $encoding = 'UTF-8')
|
||||
{
|
||||
$string = (string) $string;
|
||||
$string = (string)$string;
|
||||
if (empty($string)) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user