Passed
Push — master ( 53eead...218820 )
by Tom
03:04
created

InteractsWithRest::getOptionsUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace TomHart\Restful\Traits;
5
6
use Illuminate\Routing\Router;
7
use TomHart\Restful\Concerns\HasLinks;
8
use TomHart\Restful\LinkBuilder;
9
use TomHart\Restful\Routing\Route;
10
11
trait InteractsWithRest
12
{
13
    /**
14
     * @inheritDoc
15
     */
16
    public function getOptionsRoute(): Route
17
    {
18
        /** @var HasLinks $this */
19
        $links = LinkBuilder::buildLink($this, 'options', app(Router::class));
20
        return Route::fromArray($links);
0 ignored issues
show
Documentation introduced by
$links is of type false|array<string,*,{"m...olute\":\"string\"}>"}>, but the function expects a array<integer,*>.

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...
21
    }
22
}
23