GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — develop ( 012a1d...8e69cd )
by Toby
06:20
created

DestroyRequest::withValidator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\Module\AssignRoles\Http\Requests\ParticipantApi\AssignController;
4
5
use BristolSU\Module\AssignRoles\Rules\RoleBelongsToGroup;
6
use BristolSU\Module\AssignRoles\Rules\UserBelongsToRole;
7
use BristolSU\Module\AssignRoles\Rules\UserIsNotLoggedIntoRole;
8
use BristolSU\Support\Authentication\Contracts\Authentication;
9
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
10
use Illuminate\Contracts\Validation\Validator;
11
use Illuminate\Foundation\Http\FormRequest;
12
13
class DestroyRequest extends FormRequest
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class DestroyRequest
Loading history...
14
{
15
16 6
    public function validator(ValidationFactory $factory) 
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function validator()
Loading history...
17
    {
18 6
        return $factory->make(
19 6
            ['role' => $this->route('role'), 'user' => $this->route('user')], 
20
            [
21 6
                'role' => ['required', app(RoleBelongsToGroup::class)],
22 6
                'user' => ['required', app(UserBelongsToRole::class, ['roleId' => $this->route('role')])]
23
            ]
24
        );
25
    }
26
27 6
    public function withValidator(Validator $validator)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function withValidator()
Loading history...
28
    {
29
        $validator->sometimes('role', app(UserIsNotLoggedIntoRole::class), function($input) {
0 ignored issues
show
Bug introduced by
app(BristolSU\Module\Ass...tLoggedIntoRole::class) of type BristolSU\Module\AssignR...UserIsNotLoggedIntoRole is incompatible with the type array|string expected by parameter $rules of Illuminate\Validation\Validator::sometimes(). ( Ignorable by Annotation )

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

29
        $validator->sometimes('role', /** @scrutinizer ignore-type */ app(UserIsNotLoggedIntoRole::class), function($input) {
Loading history...
Unused Code introduced by
The parameter $input 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

29
        $validator->sometimes('role', app(UserIsNotLoggedIntoRole::class), function(/** @scrutinizer ignore-unused */ $input) {

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...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
30 6
            return app(Authentication::class)->getUser()->id() === (int) $this->route('user');
31 6
        });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
32 6
    }
33
34
}