-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hacky fix for #15154 until yiisoft/yii2#20191 is fixed
- Loading branch information
1 parent
147134f
commit aa48f03
Showing
4 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* @link https://craftcms.com/ | ||
* @copyright Copyright (c) Pixel & Tonic, Inc. | ||
* @license https://craftcms.github.io/license/ | ||
*/ | ||
|
||
namespace yii\helpers; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
class ArrayHelper extends BaseArrayHelper | ||
{ | ||
public static function recursiveSort(array &$array, $sorter = null) | ||
{ | ||
foreach ($array as &$value) { | ||
if (is_array($value)) { | ||
static::recursiveSort($value, $sorter); | ||
} | ||
} | ||
unset($value); | ||
|
||
if ($sorter === null) { | ||
if (static::isIndexed($array)) { | ||
// leave it alone for now, until https://github.com/yiisoft/yii2/issues/20191 is fixed | ||
return $array; | ||
} | ||
$sorter = 'ksort'; | ||
} | ||
|
||
call_user_func_array($sorter, [&$array]); | ||
|
||
return $array; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters