From 7b1d14aa02d90291062fc05923cd0e9fb8b52870 Mon Sep 17 00:00:00 2001 From: Raj Siva-Rajah <5361908+binaryfire@users.noreply.github.com> Date: Fri, 26 Dec 2025 00:31:08 +0000 Subject: [PATCH 1/2] Add channel() method to Broadcaster contract The Broadcast::channel() method was not exposed in the Broadcaster contract, causing static analysis tools to report it as undefined when using the Broadcast facade. - Add channel() to Broadcaster contract interface - Add channel() implementation to BroadcastPoolProxy - Add @method annotation to Broadcast facade --- src/broadcasting/src/BroadcastPoolProxy.php | 11 +++++++++++ src/broadcasting/src/Contracts/Broadcaster.php | 5 +++++ src/support/src/Facades/Broadcast.php | 1 + 3 files changed, 17 insertions(+) diff --git a/src/broadcasting/src/BroadcastPoolProxy.php b/src/broadcasting/src/BroadcastPoolProxy.php index c8e71cbd2..a15cb0c22 100644 --- a/src/broadcasting/src/BroadcastPoolProxy.php +++ b/src/broadcasting/src/BroadcastPoolProxy.php @@ -6,10 +6,21 @@ use Hyperf\HttpServer\Contract\RequestInterface; use Hypervel\Broadcasting\Contracts\Broadcaster; +use Hypervel\Broadcasting\Contracts\HasBroadcastChannel; use Hypervel\ObjectPool\PoolProxy; class BroadcastPoolProxy extends PoolProxy implements Broadcaster { + /** + * Register a channel authenticator. + */ + public function channel(HasBroadcastChannel|string $channel, callable|string $callback, array $options = []): static + { + $this->__call(__FUNCTION__, func_get_args()); + + return $this; + } + public function auth(RequestInterface $request): mixed { return $this->__call(__FUNCTION__, func_get_args()); diff --git a/src/broadcasting/src/Contracts/Broadcaster.php b/src/broadcasting/src/Contracts/Broadcaster.php index d7c09468c..272c81755 100644 --- a/src/broadcasting/src/Contracts/Broadcaster.php +++ b/src/broadcasting/src/Contracts/Broadcaster.php @@ -8,6 +8,11 @@ interface Broadcaster { + /** + * Register a channel authenticator. + */ + public function channel(HasBroadcastChannel|string $channel, callable|string $callback, array $options = []): static; + /** * Authenticate the incoming request for a given channel. */ diff --git a/src/support/src/Facades/Broadcast.php b/src/support/src/Facades/Broadcast.php index ff279e48c..547dc25c1 100644 --- a/src/support/src/Facades/Broadcast.php +++ b/src/support/src/Facades/Broadcast.php @@ -7,6 +7,7 @@ use Hypervel\Broadcasting\Contracts\Factory as BroadcastingFactoryContract; /** + * @method static \Hypervel\Broadcasting\Contracts\Broadcaster channel(\Hypervel\Broadcasting\Contracts\HasBroadcastChannel|string $channel, callable|string $callback, array $options = []) * @method static void routes(array $attributes = []) * @method static void userRoutes(array|null $attributes = null) * @method static void channelRoutes(array|null $attributes = null) From 164161446beb50cd14058f843cb7789c79110a19 Mon Sep 17 00:00:00 2001 From: Raj Siva-Rajah <5361908+binaryfire@users.noreply.github.com> Date: Fri, 26 Dec 2025 00:36:53 +0000 Subject: [PATCH 2/2] Regenerate Broadcast facade docblock via facade-documenter --- src/support/src/Facades/Broadcast.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/support/src/Facades/Broadcast.php b/src/support/src/Facades/Broadcast.php index 547dc25c1..bd84b6f22 100644 --- a/src/support/src/Facades/Broadcast.php +++ b/src/support/src/Facades/Broadcast.php @@ -7,7 +7,6 @@ use Hypervel\Broadcasting\Contracts\Factory as BroadcastingFactoryContract; /** - * @method static \Hypervel\Broadcasting\Contracts\Broadcaster channel(\Hypervel\Broadcasting\Contracts\HasBroadcastChannel|string $channel, callable|string $callback, array $options = []) * @method static void routes(array $attributes = []) * @method static void userRoutes(array|null $attributes = null) * @method static void channelRoutes(array|null $attributes = null) @@ -34,6 +33,7 @@ * @method static \Hypervel\Broadcasting\BroadcastManager removePoolable(string $driver) * @method static array getPoolables() * @method static \Hypervel\Broadcasting\BroadcastManager setPoolables(array $poolables) + * @method static \Hypervel\Broadcasting\Contracts\Broadcaster channel(\Hypervel\Broadcasting\Contracts\HasBroadcastChannel|string $channel, callable|string $callback, array $options = []) * @method static mixed auth(\Hyperf\HttpServer\Contract\RequestInterface $request) * @method static mixed validAuthenticationResponse(\Hyperf\HttpServer\Contract\RequestInterface $request, mixed $result) * @method static void broadcast(array $channels, string $event, array $payload = [])