psalm-plugin-laravel icon indicating copy to clipboard operation
psalm-plugin-laravel copied to clipboard

Support Query Scope classes

Open caugner opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe.

Query Scope classes can be created using make:scope as an alternative to creating "local" scopes inside the Model class directly. The Scope interface has an apply() method that takes two parameters, Builder $builder and Model $model and these can not be overwritten in a Scope implementation, as this causes Psalm to emit a MoreSpecifciImplementedParamType error.

Describe the solution you'd like The Scope interface should be extended with a @template TModel of Model, so that the apply() parameters can be typed as @param Builder<TModel> $builder and @param TModel $model respectively.

Describe alternatives you've considered (None.)

Additional context

caugner avatar Nov 26 '21 11:11 caugner