mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-16 14:29:30 +08:00
Merge pull request #3356 from netyum/patch-2
Fixed document for multisort in BaseArrayHelper
This commit is contained in:
@@ -401,7 +401,7 @@ class BaseArrayHelper
|
||||
* `SORT_REGULAR`, `SORT_NUMERIC`, `SORT_STRING`, `SORT_LOCALE_STRING`, `SORT_NATURAL` and `SORT_FLAG_CASE`.
|
||||
* Please refer to [PHP manual](http://php.net/manual/en/function.sort.php)
|
||||
* for more details. When sorting by multiple keys with different sort flags, use an array of sort flags.
|
||||
* @throws InvalidParamException if the $descending or $sortFlag parameters do not have
|
||||
* @throws InvalidParamException if the $direction or $sortFlag parameters do not have
|
||||
* correct number of elements as that of $key.
|
||||
*/
|
||||
public static function multisort(&$array, $key, $direction = SORT_ASC, $sortFlag = SORT_REGULAR)
|
||||
@@ -414,7 +414,7 @@ class BaseArrayHelper
|
||||
if (is_scalar($direction)) {
|
||||
$direction = array_fill(0, $n, $direction);
|
||||
} elseif (count($direction) !== $n) {
|
||||
throw new InvalidParamException('The length of $descending parameter must be the same as that of $keys.');
|
||||
throw new InvalidParamException('The length of $direction parameter must be the same as that of $keys.');
|
||||
}
|
||||
if (is_scalar($sortFlag)) {
|
||||
$sortFlag = array_fill(0, $n, $sortFlag);
|
||||
|
||||
Reference in New Issue
Block a user