1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 08:04:03 +00:00

Resolve misc todos, fix phpstan error

This commit is contained in:
Samuel Štancl 2025-10-19 18:44:58 +02:00
parent be93d6031c
commit 5dfb4843b9
No known key found for this signature in database
GPG key ID: BA146259A1E16C57
4 changed files with 8 additions and 8 deletions

View file

@ -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
{

View file

@ -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

View file

@ -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.
*

View file

@ -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;