Passed
Pull Request — master (#26)
by
unknown
03:27
created

UserRequest::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 6
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\User;
6
7
use Yiisoft\Auth\Middleware\Authentication;
8
use Yiisoft\RequestModel\RequestModel;
9
10
final class UserRequest extends RequestModel
11
{
12 2
    public function getUser(): User
13
    {
14
        /**
15
         * @var User $identity
16
         */
17 2
        return $this->getValue('attributes.' . Authentication::class);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValue('...\Authentication::class) could return the type null which is incompatible with the type-hinted return App\User\User. Consider adding an additional type-check to rule them out.
Loading history...
18
    }
19
}
20