Issues (4)

src/RequestQueryHelperServiceProvider.php (2 issues)

1
<?php
2
3
namespace ApiChef\RequestQueryHelper;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Support\ServiceProvider;
7
8
class RequestQueryHelperServiceProvider extends ServiceProvider
9
{
10 33
    public function boot()
11
    {
12 33
        $this->publishes([
13 33
            __DIR__.'/../config/request-query-helper.php' => config_path('request-query-helper.php'),
14 33
        ], 'config');
15
16
        Request::macro('filters', function () {
17 6
            return new QueryParamBag($this->get(config('request-query-helper.filter.name')));
0 ignored issues
show
The method get() does not exist on ApiChef\RequestQueryHelp...ryHelperServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
            return new QueryParamBag($this->/** @scrutinizer ignore-call */ get(config('request-query-helper.filter.name')));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18 33
        });
19
20
        Request::macro('includes', function () {
21 6
            return new QueryParamBag($this->get(config('request-query-helper.include.name')));
22 33
        });
23
24
        Request::macro('fields', function () {
25 12
            return new Fields($this->get(config('request-query-helper.fields.name'), []));
26 33
        });
27
28
        Request::macro('sorts', function () {
29 6
            return new Sorts($this->get(config('request-query-helper.sort.name')));
30 33
        });
31
32
        Request::macro('paginationParams', function () {
33 6
            return new PaginationParams(config('request-query-helper.pagination'), $this);
0 ignored issues
show
$this of type ApiChef\RequestQueryHelp...ryHelperServiceProvider is incompatible with the type Illuminate\Http\Request expected by parameter $request of ApiChef\RequestQueryHelp...onParams::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

33
            return new PaginationParams(config('request-query-helper.pagination'), /** @scrutinizer ignore-type */ $this);
Loading history...
34 33
        });
35 33
    }
36
37 33
    public function register(): void
38
    {
39 33
        $this->mergeConfigFrom(
40 33
            __DIR__.'/../config/request-query-helper.php',
41 33
            'query-params'
42
        );
43 33
    }
44
}
45