MemberController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A current() 0 4 1
1
<?php
2
3
namespace App\Http\Controllers\API;
4
5
use Illuminate\Support\Facades\Auth;
6
7
/**
8
 * Class MemberController
9
 * @package App\Http\Controllers\API
10
 */
11
class MemberController extends Controller
12
{
13
    /**
14
     * @SWG\Get(
15
     *     tags={"Member"},
16
     *     path="/api/v1/me",
17
     *     description="Returns authenticated user",
18
     *     operationId="current",
19
     *     produces={"application/json"},
20
     *     @SWG\Response(
21
     *     response="200",
22
     *     description="Successfully get authenticated user"
23
     *     )
24
     * )
25
     */
26
    public function current()
27
    {
28
        return response()->json(Auth::user());
0 ignored issues
show
Documentation introduced by
\Illuminate\Support\Facades\Auth::user() is of type object<Illuminate\Contra...h\Authenticatable>|null, but the function expects a string|array.

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...
29
    }
30
}
31