Skip to content

Commit

Permalink
PHP 8.1 trim(): Passing null to parameter yiisoft#1 ($string) of type…
Browse files Browse the repository at this point in the history
… string is deprecated
  • Loading branch information
uaoleg authored Jan 8, 2023
1 parent 7ed855c commit c91b9e1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions framework/db/QueryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ protected function isEmpty($value)

/**
* Sets the ORDER BY part of the query.
* @param string|array|ExpressionInterface $columns the columns (and the directions) to be ordered by.
* @param string|array|ExpressionInterface|null $columns the columns (and the directions) to be ordered by.
* Columns can be specified in either a string (e.g. `"id ASC, name DESC"`) or an array
* (e.g. `['id' => SORT_ASC, 'name' => SORT_DESC]`).
*
Expand Down Expand Up @@ -358,12 +358,14 @@ public function addOrderBy($columns)
/**
* Normalizes format of ORDER BY data.
*
* @param array|string|ExpressionInterface $columns the columns value to normalize. See [[orderBy]] and [[addOrderBy]].
* @param array|string|ExpressionInterface|null $columns the columns value to normalize. See [[orderBy]] and [[addOrderBy]].
* @return array
*/
protected function normalizeOrderBy($columns)
{
if ($columns instanceof ExpressionInterface) {
if (empty($columns)) {
return [];
} elseif ($columns instanceof ExpressionInterface) {
return [$columns];
} elseif (is_array($columns)) {
return $columns;
Expand Down

0 comments on commit c91b9e1

Please sign in to comment.