LaravelOverflowServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace CraftLogan\LaravelOverflow;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Http\Request;
7
use Illuminate\Support\ServiceProvider;
8
9
class LaravelOverflowServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14
    public function boot()
15
    {
16
        Request::macro('overflow', function (Model $model, $properties = "properties") {
17
            $overflow = new LaravelOverflow($this, $model, $properties);
0 ignored issues
show
Documentation introduced by
$this is of type this<CraftLogan\LaravelO...verflowServiceProvider>, but the function expects a object<Illuminate\Http\Request>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
18
            return $overflow->overflow();
19
        });
20
21
        Request::macro('allWithOverflow', function (Model $model, $properties = "properties") {
22
            $overflow = new LaravelOverflow($this, $model, $properties);
0 ignored issues
show
Documentation introduced by
$this is of type this<CraftLogan\LaravelO...verflowServiceProvider>, but the function expects a object<Illuminate\Http\Request>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
23
            return $overflow->allWithOverflow();
24
        });
25
    }
26
27
    /**
28
     * Register the application services.
29
     */
30
    public function register()
31
    {
32
        //
33
    }
34
}
35