diff --git a/src/RefineQuery.php b/src/RefineQuery.php index 4bd91f0..1ba6c3c 100644 --- a/src/RefineQuery.php +++ b/src/RefineQuery.php @@ -2,9 +2,9 @@ namespace Laragear\Refine; +use Illuminate\Contracts\Database\Eloquent\Builder as EloquentBuilder; +use Illuminate\Contracts\Database\Query\Builder; use Illuminate\Contracts\Validation\Factory as ValidationFactory; -use Illuminate\Database\Eloquent\Builder as EloquentBuilder; -use Illuminate\Database\Query\Builder; use Illuminate\Foundation\Precognition; use Illuminate\Http\Request; use Illuminate\Support\Collection; @@ -74,7 +74,7 @@ public function match(array $keys = null): void /** * Validate the refiner. */ - protected function validateRefiner() + protected function validateRefiner(): void { $validator = app(ValidationFactory::class)->make( $this->request->query(), diff --git a/src/RefineServiceProvider.php b/src/RefineServiceProvider.php index 47866a5..0b47009 100644 --- a/src/RefineServiceProvider.php +++ b/src/RefineServiceProvider.php @@ -2,6 +2,8 @@ namespace Laragear\Refine; +use Illuminate\Contracts\Database\Eloquent\Builder as EloquentBuilderContract; +use Illuminate\Contracts\Database\Query\Builder as BuilderContract; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Query\Builder; use Illuminate\Support\ServiceProvider; @@ -15,8 +17,8 @@ class RefineServiceProvider extends ServiceProvider */ public function boot(): void { - $callback = function (object|string $refiner, array $keys = null): Builder|EloquentBuilder { - /** @var \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $this */ + $callback = function (object|string $refiner, array $keys = null): BuilderContract|EloquentBuilderContract { + /** @var \Illuminate\Contracts\Database\Query\Builder|\Illuminate\Contracts\Database\Eloquent\Builder $this */ return RefineQuery::refine($this, $refiner, $keys); }; diff --git a/src/Refiner.php b/src/Refiner.php index 2f18ddb..2ecd553 100644 --- a/src/Refiner.php +++ b/src/Refiner.php @@ -2,8 +2,8 @@ namespace Laragear\Refine; -use Illuminate\Database\Eloquent\Builder as EloquentBuilder; -use Illuminate\Database\Query\Builder; +use Illuminate\Contracts\Database\Eloquent\Builder as EloquentBuilder; +use Illuminate\Contracts\Database\Query\Builder; use Illuminate\Http\Request; abstract class Refiner @@ -30,10 +30,6 @@ public function getObligatoryKeys(Request $request): array /** * Run before the refiner executes its matched methods. - * - * @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Http\Request $request - * @return void */ public function runBefore(Builder|EloquentBuilder $query, Request $request): void { @@ -42,10 +38,6 @@ public function runBefore(Builder|EloquentBuilder $query, Request $request): voi /** * Run after the refiner has executed all its matched methods. - * - * @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Http\Request $request - * @return void */ public function runAfter(Builder|EloquentBuilder $query, Request $request): void {