make params an empty array instead of null

This commit is contained in:
Sky Johnson 2024-09-20 16:11:03 -05:00
parent a399c75cd7
commit 2bf838b8ba

View File

@ -72,13 +72,13 @@ class SegmentRouter implements RouterInterface
}
// if we can't find a node for this segment, return 404
return ['code' => 404, 'handler' => null, 'params' => null];
return ['code' => 404, 'handler' => null, 'params' => []];
}
// if we found a handler for the method, return it and any params. if not, return a 405
return isset($node[$method])
? ['code' => 200, 'handler' => $node[$method], 'params' => $params ?? null]
: ['code' => 405, 'handler' => null, 'params' => null];
? ['code' => 200, 'handler' => $node[$method], 'params' => $params ?? []]
: ['code' => 405, 'handler' => null, 'params' => []];
}
/**