From 1bb727f322cac0241b6a405ebc8024416fd5c9a9 Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Tue, 30 Mar 2021 18:11:58 +0300 Subject: [PATCH] Removing higher-order from collection-related tasks --- src/ChannelManagers/LocalChannelManager.php | 4 +++- src/Channels/Channel.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ChannelManagers/LocalChannelManager.php b/src/ChannelManagers/LocalChannelManager.php index 3cacbf4f17..913744baea 100644 --- a/src/ChannelManagers/LocalChannelManager.php +++ b/src/ChannelManagers/LocalChannelManager.php @@ -179,7 +179,9 @@ public function unsubscribeFromAllChannels(ConnectionInterface $connection): Pro }); collect($channels) - ->reject->hasConnections() + ->reject(function ($channel) { + return $channel->hasConnections(); + }) ->each(function (Channel $channel, string $channelName) use ($connection) { unset($this->channels[$connection->app->id][$channelName]); }); diff --git a/src/Channels/Channel.php b/src/Channels/Channel.php index fd857e233f..7cc7f375a2 100644 --- a/src/Channels/Channel.php +++ b/src/Channels/Channel.php @@ -156,7 +156,9 @@ public function saveConnection(ConnectionInterface $connection) public function broadcast($appId, stdClass $payload, bool $replicate = true): bool { collect($this->getConnections()) - ->each->send(json_encode($payload)); + ->each(function ($connection) use ($payload) { + $connection->send(json_encode($payload)); + }); if ($replicate) { $this->channelManager->broadcastAcrossServers($appId, null, $this->getName(), $payload);