Skip to content

Commit 937c8c8

Browse files
committed
Delete the redundant BroadcastingFactory::class arg from the Broadcast::clearResolvedInstance calls
Also in bootstrap(), update the clearResolvedInstance comment. Remove the FQCN mention and explain why exactly do we need to clear the resolved instance
1 parent 9af1735 commit 937c8c8

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/Bootstrappers/BroadcastingConfigBootstrapper.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Illuminate\Broadcasting\BroadcastManager;
88
use Illuminate\Config\Repository;
99
use Illuminate\Contracts\Broadcasting\Broadcaster;
10-
use Illuminate\Contracts\Broadcasting\Factory as BroadcastingFactory;
1110
use Illuminate\Foundation\Application;
1211
use Illuminate\Support\Facades\Broadcast;
1312
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
@@ -103,10 +102,10 @@ public function bootstrap(Tenant $tenant): void
103102
return $this->app->make(BroadcastManager::class)->connection();
104103
});
105104

106-
// Clear the resolved Broadcast facade's Illuminate\Contracts\Broadcasting\Factory instance
107-
// so that it gets re-resolved as TenancyBroadcastManager instead of the central BroadcastManager
108-
// when used. E.g. the Broadcast::auth() call in BroadcastController::authenticate (/broadcasting/auth).
109-
Broadcast::clearResolvedInstance(BroadcastingFactory::class);
105+
// Extending the binding doesn't update the Broadcast facade's cached instance,
106+
// so clear it to make the facade re-resolve to TenancyBroadcastManager instead of the central
107+
// BroadcastManager — e.g. in the Broadcast::auth() call in BroadcastController (/broadcasting/auth).
108+
Broadcast::clearResolvedInstance();
110109
}
111110

112111
public function revert(): void
@@ -116,7 +115,7 @@ public function revert(): void
116115
$this->app->singleton(Broadcaster::class, fn (Application $app) => $this->originalBroadcaster);
117116

118117
// Clear the resolved Broadcast facade instance so that it gets re-resolved as the central BroadcastManager
119-
Broadcast::clearResolvedInstance(BroadcastingFactory::class);
118+
Broadcast::clearResolvedInstance();
120119

121120
$this->unsetConfig();
122121
}

0 commit comments

Comments
 (0)