mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 07:04:03 +00:00
more phpstan fixes
This commit is contained in:
parent
a4318d81bd
commit
87e02f207f
4 changed files with 15 additions and 2 deletions
|
|
@ -16,6 +16,8 @@ parameters:
|
|||
ignoreErrors:
|
||||
-
|
||||
identifier: missingType.iterableValue
|
||||
- '#Return type(.*?) of method Stancl\\Tenancy\\Database\\Models\\Tenant\:\:newCollection\(\) should be compatible with return type#'
|
||||
- '#Method Stancl\\Tenancy\\Database\\Models\\Tenant\:\:newCollection\(\) should return#'
|
||||
- '#Cannot access offset (.*?) on Illuminate\\Contracts\\Foundation\\Application#'
|
||||
- '#Cannot access offset (.*?) on Illuminate\\Contracts\\Config\\Repository#'
|
||||
- '#Call to an undefined method(.*?)Tenant\:\:run\(\).#'
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
interface Domain
|
||||
{
|
||||
/**
|
||||
* @return BelongsTo<Tenant&Model, Model>
|
||||
* @return BelongsTo<Tenant&Model, $this&Model>
|
||||
*/
|
||||
public function tenant(): BelongsTo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,16 @@ class Domain extends Model implements Contracts\Domain
|
|||
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Tenant&Model, $this>
|
||||
*/
|
||||
public function tenant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(config('tenancy.models.tenant'), Tenancy::tenantKeyColumn());
|
||||
/** @var class-string<Tenant&Model> $tenantModel */
|
||||
$tenantModel = config('tenancy.models.tenant');
|
||||
|
||||
/** @var BelongsTo<Model&Tenant, $this> */
|
||||
return $this->belongsTo($tenantModel, Tenancy::tenantKeyColumn());
|
||||
}
|
||||
|
||||
protected $dispatchesEvents = [
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ class Tenant extends Model implements Contracts\Tenant
|
|||
return static::current() ?? throw new TenancyNotInitializedException;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<self> $models
|
||||
* @return TenantCollection<int|string, self>
|
||||
*/
|
||||
public function newCollection(array $models = []): TenantCollection
|
||||
{
|
||||
return new TenantCollection($models);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue