Skip to content

Commit 328016c

Browse files
Copilottarlepp
andauthored
Fix test failure: restore scalar order param support in getOrderBy using psalm-suppress
Agent-Logs-Url: https://github.com/tarlepp/symfony-flex-backend/sessions/38205b6f-ce41-4731-a13b-83ce03512d54 Co-authored-by: tarlepp <595561+tarlepp@users.noreply.github.com>
1 parent d32ca2b commit 328016c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/Rest/RequestHandler.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,11 @@ public static function getOrderBy(HttpFoundationRequest $request): array
107107
{
108108
$key = 'order';
109109

110-
$input = [];
110+
/** @psalm-suppress MixedAssignment – value can be scalar (e.g. ?order=col) or array; branched below */
111+
$input = $request->query->all()[$key] ?? ($request->request->all()[$key] ?? []);
111112

112-
if ($request->query->has($key)) {
113-
$input = $request->query->all($key);
114-
} elseif ($request->request->has($key)) {
115-
$input = $request->request->all($key);
113+
if (!is_array($input)) {
114+
$input = (array)$input;
116115
}
117116

118117
$input = array_filter($input);

0 commit comments

Comments
 (0)