mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:44:04 +00:00
phpstan fixes
This commit is contained in:
parent
3c183e45d9
commit
f955b38e2b
12 changed files with 24 additions and 21 deletions
|
|
@ -10,6 +10,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
use Stancl\Tenancy\Database\Contracts\TenantWithDatabase;
|
||||
use Stancl\Tenancy\Database\TenantCollection;
|
||||
use Stancl\Tenancy\Listeners\QueueableListener;
|
||||
use Stancl\Tenancy\ResourceSyncing\Events\SyncedResourceSaved;
|
||||
|
|
@ -93,7 +94,7 @@ class UpdateOrCreateSyncedResource extends QueueableListener
|
|||
|
||||
// If the model was just created, the mapping of the tenant to the user likely doesn't exist, so we create it.
|
||||
$currentTenantMapping = function ($model) use ($event) {
|
||||
/** @var Tenant */
|
||||
/** @var TenantWithDatabase */
|
||||
$tenant = $event->tenant;
|
||||
|
||||
return ((string) $model->pivot->getAttribute(Tenancy::tenantKeyColumn())) === ((string) $tenant->getTenantKey());
|
||||
|
|
@ -105,7 +106,7 @@ class UpdateOrCreateSyncedResource extends QueueableListener
|
|||
// Here we should call TenantPivot, but we call general Pivot, so that this works
|
||||
// even if people use their own pivot model that is not based on our TenantPivot
|
||||
Pivot::withoutEvents(function () use ($centralModel, $event) {
|
||||
/** @var Tenant */
|
||||
/** @var TenantWithDatabase */
|
||||
$tenant = $event->tenant;
|
||||
|
||||
$centralModel->tenants()->attach($tenant->getTenantKey());
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use Stancl\Tenancy\Database\Contracts\TenantWithDatabase;
|
|||
// todo@move move all resource syncing-related things to a separate namespace?
|
||||
|
||||
/**
|
||||
* @property-read TenantWithDatabase[]|Collection<TenantWithDatabase> $tenants
|
||||
* @property-read TenantWithDatabase[]|Collection<int, TenantWithDatabase&Model> $tenants
|
||||
*/
|
||||
interface SyncMaster extends Syncable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ trait TriggerSyncingEvents
|
|||
|
||||
public function getCentralResourceAndTenant(): array
|
||||
{
|
||||
/** @var static&Pivot $this */
|
||||
/** @var $this&Pivot $this */
|
||||
$parent = $this->pivotParent;
|
||||
|
||||
if ($parent instanceof Tenant) {
|
||||
|
|
@ -79,7 +79,7 @@ trait TriggerSyncingEvents
|
|||
*/
|
||||
protected function getResourceClass(): string
|
||||
{
|
||||
/** @var Pivot|MorphPivot|((Pivot|MorphPivot)&PivotWithRelation) $this */
|
||||
/** @var $this&(Pivot|MorphPivot|((Pivot|MorphPivot)&PivotWithRelation)) $this */
|
||||
if ($this instanceof PivotWithRelation) {
|
||||
return $this->getRelatedModel()::class;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue