1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 18:04:03 +00:00

phpstan fix: Scope generics

phpstan started failing with '... implements generic interface
Illuminate\Database\Eloquent\Scope but does not specify its types:
TModel'. We solve this by adding an implements docblock to the scopes
implementing that interface. They're fairly generic - we just use the
Model type itself in the code - so we use Model for the type parameter.
This commit is contained in:
Samuel Stancl 2026-04-15 11:09:22 +02:00
parent e31249dd09
commit c32f52ce7c
No known key found for this signature in database
GPG key ID: BA146259A1E16C57
3 changed files with 3 additions and 0 deletions

View file

@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope; use Illuminate\Database\Eloquent\Scope;
/** @implements Scope<Model> */
class PendingScope implements Scope class PendingScope implements Scope
{ {
/** /**

View file

@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope; use Illuminate\Database\Eloquent\Scope;
/** @implements Scope<Model> */
class ParentModelScope implements Scope class ParentModelScope implements Scope
{ {
/** /**

View file

@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope; use Illuminate\Database\Eloquent\Scope;
use Stancl\Tenancy\Tenancy; use Stancl\Tenancy\Tenancy;
/** @implements Scope<Model> */
class TenantScope implements Scope class TenantScope implements Scope
{ {
/** /**