Skip to content

Commit

Permalink
fix(spec): use Socket.t() instead of %Socket{} (#3634)
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp authored Jan 17, 2025
1 parent b35912d commit 5337f43
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/phoenix_live_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1753,8 +1753,8 @@ defmodule Phoenix.LiveView do
prepend items (with `at: 0`) to the stream, the non-stream item will be pushed down.
"""
@spec stream(%Socket{}, name :: atom | String.t(), items :: Enumerable.t(), opts :: Keyword.t()) ::
%Socket{}
@spec stream(socket :: Socket.t(), name :: atom | String.t(), items :: Enumerable.t(), opts :: Keyword.t()) ::
Socket.t()
def stream(%Socket{} = socket, name, items, opts \\ []) do
socket
|> ensure_streams()
Expand Down Expand Up @@ -1792,7 +1792,7 @@ defmodule Phoenix.LiveView do
Returns an updated `socket`.
"""
@spec stream_configure(%Socket{}, name :: atom | String.t(), opts :: Keyword.t()) :: %Socket{}
@spec stream_configure(socket :: Socket.t(), name :: atom | String.t(), opts :: Keyword.t()) :: Socket.t()
def stream_configure(%Socket{} = socket, name, opts) when is_list(opts) do
new_socket = ensure_streams(socket)

Expand Down Expand Up @@ -1875,8 +1875,8 @@ defmodule Phoenix.LiveView do
See `stream_delete/3` for more information on deleting items.
"""
@spec stream_insert(%Socket{}, name :: atom | String.t(), item :: any, opts :: Keyword.t()) ::
%Socket{}
@spec stream_insert(socket :: Socket.t(), name :: atom | String.t(), item :: any, opts :: Keyword.t()) ::
Socket.t()
def stream_insert(%Socket{} = socket, name, item, opts \\ []) do
at = Keyword.get(opts, :at, -1)
limit = Keyword.get(opts, :limit)
Expand Down Expand Up @@ -1904,7 +1904,7 @@ defmodule Phoenix.LiveView do
Returns an updated `socket`.
"""
@spec stream_delete(%Socket{}, name :: atom | String.t(), item :: any) :: %Socket{}
@spec stream_delete(socket :: Socket.t(), name :: atom | String.t(), item :: any) :: Socket.t()
def stream_delete(%Socket{} = socket, name, item) do
update_stream(socket, name, &LiveStream.delete_item(&1, item))
end
Expand Down Expand Up @@ -1940,8 +1940,8 @@ defmodule Phoenix.LiveView do
{:noreply, stream_delete_by_dom_id(socket, :songs, dom_id)}
end
'''
@spec stream_delete_by_dom_id(%Socket{}, name :: atom | String.t(), id :: String.t()) ::
%Socket{}
@spec stream_delete_by_dom_id(socket :: Socket.t(), name :: atom | String.t(), id :: String.t()) ::
Socket.t()
def stream_delete_by_dom_id(%Socket{} = socket, name, id) do
update_stream(socket, name, &LiveStream.delete_item_by_dom_id(&1, id))
end
Expand Down

0 comments on commit 5337f43

Please sign in to comment.