AuthServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 3
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A registerAuthenticator() 0 13 1
1
<?php
2
3
namespace App\Auth;
4
5
use Illuminate\Auth\AuthServiceProvider as ServiceProvider;
6
7
/**
8
 * Class AuthServiceProvider
9
 * @package App\Auth
10
 */
11
class AuthServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * @inheritdoc
15
     */
16
    protected function registerAuthenticator()
17
    {
18
        $this->app->bind('auth', function ($app) {
19
            // Once the authentication service has actually been requested by the developer
20
            // we will set a variable in the application indicating such. This helps us
21
            // know that we need to set any queued cookies in the after event later.
22
            $app['auth.loaded'] = true;
23
            return new AuthManager($app);
0 ignored issues
show
Documentation introduced by
$app is of type array<string,boolean,{"auth.loaded":"boolean"}>, but the function expects a object<Illuminate\Foundation\Application>.

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...
24
        });
25
        $this->app->singleton('auth.driver', function ($app) {
26
            return $app['auth']->guard();
27
        });
28
    }
29
}
30