Pleroma.Web.ControllerHelper: fix @spec to resolve dialyzer errors

lib/pleroma/web/admin_api/controllers/user_controller.ex:333:no_return
Function index/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:357:unused_fun
Function maybe_parse_filters/1 will never be called.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:366:no_return
Function page_params/1 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:368:call
The function call will not succeed.

Pleroma.Web.ControllerHelper.fetch_integer_param(_params :: any(), :page, 1)

breaks the contract
(map(), String.t(), integer() | nil) :: integer() | nil
This commit is contained in:
Mark Felder 2024-01-31 11:01:37 -05:00
parent 3b9d991514
commit c6f783c551

View File

@ -20,7 +20,7 @@ defmodule Pleroma.Web.ControllerHelper do
|> json(json)
end
@spec fetch_integer_param(map(), String.t(), integer() | nil) :: integer() | nil
@spec fetch_integer_param(map(), String.t() | atom(), integer() | nil) :: integer() | nil
def fetch_integer_param(params, name, default \\ nil) do
params
|> Map.get(name, default)