diff --git a/src/Concerns/DealsWithRouteContexts.php b/src/Concerns/DealsWithRouteContexts.php index 9a9b0871..fdf49cb1 100644 --- a/src/Concerns/DealsWithRouteContexts.php +++ b/src/Concerns/DealsWithRouteContexts.php @@ -14,10 +14,9 @@ use Illuminate\Support\Arr; use Illuminate\Support\Facades\Route as RouteFacade; use Stancl\Tenancy\Enums\RouteMode; -// todo@refactor move this logic to some dedicated static class? - /** * @mixin \Stancl\Tenancy\Tenancy + * @internal The public methods in this trait should not be understood to be a public stable API. */ trait DealsWithRouteContexts { diff --git a/src/Features/DisallowSqliteAttach.php b/src/Features/DisallowSqliteAttach.php index 36621b21..5cbfbf50 100644 --- a/src/Features/DisallowSqliteAttach.php +++ b/src/Features/DisallowSqliteAttach.php @@ -71,6 +71,7 @@ class DisallowSqliteAttach implements Feature protected function setNativeAuthorizer(PDO $pdo): void { + // @phpstan-ignore method.notFound $pdo->setAuthorizer(static function (int $action): int { return $action === 24 // SQLITE_ATTACH ? PDO\Sqlite::DENY diff --git a/src/Listeners/ForgetTenantParameter.php b/src/Listeners/ForgetTenantParameter.php index d159b967..46bf5690 100644 --- a/src/Listeners/ForgetTenantParameter.php +++ b/src/Listeners/ForgetTenantParameter.php @@ -8,8 +8,6 @@ use Illuminate\Routing\Events\RouteMatched; use Stancl\Tenancy\Enums\RouteMode; use Stancl\Tenancy\Resolvers\PathTenantResolver; -// todo@earlyIdReview - /** * Conditionally removes the tenant parameter from matched routes when using kernel path identification. * diff --git a/src/Tenancy.php b/src/Tenancy.php index 95eeb950..f9c9c9ae 100644 --- a/src/Tenancy.php +++ b/src/Tenancy.php @@ -33,7 +33,7 @@ class Tenancy public ?Closure $getBootstrappersUsing = null; /** Is tenancy fully initialized? */ - public bool $initialized = false; // todo@docs document the difference between $tenant being set and $initialized being true (e.g. end of initialize() method) + public bool $initialized = false; /** * List of relations to eager load when fetching a tenant via tenancy()->find(). @@ -139,10 +139,12 @@ class Tenancy return; } + // We fire both of these events before unsetting tenant so that listeners + // to both events can access the current tenant. Having separate events + // still has value as it's consistent with our other events and provides + // more granularity for event listeners, e.g. for ensuring something runs + // before standard TenancyEnded listeners such as RevertToCentralContext. event(new Events\EndingTenancy($this)); - - // todo@samuel find a way to refactor these two methods - event(new Events\TenancyEnded($this)); $this->tenant = null;