Passed
Pull Request — master (#439)
by Kirill
06:35
created

DemoController::guardedButNoNameAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\App\Controller;
13
14
use Spiral\App\User\Role;
15
use Spiral\App\User\User;
16
use Spiral\Domain\Annotation\Guarded;
17
18
class DemoController
19
{
20
    public function entity(User $user)
21
    {
22
        return $user->getName();
23
    }
24
25
    public function entity2(User $user, Role $role)
0 ignored issues
show
Unused Code introduced by
The parameter $user is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
    public function entity2(/** @scrutinizer ignore-unused */ User $user, Role $role)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $role is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
    public function entity2(User $user, /** @scrutinizer ignore-unused */ Role $role)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        return 'ok';
28
    }
29
30
    /**
31
     * @Guarded()
32
     * @return string
33
     */
34
    public function guardedButNoName()
35
    {
36
        return 'ok';
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    #[Guarded()]
43
    public function guardedButNoNameAttribute()
44
    {
45
        return 'ok';
46
    }
47
48
    /**
49
     * @Guarded("do")
50
     * @return string
51
     */
52
    public function do()
53
    {
54
        return 'ok';
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    #[Guarded(permission: 'do')]
61
    public function doAttribute()
62
    {
63
        return 'ok';
64
    }
65
}
66