1 | <?php |
||||||
2 | |||||||
0 ignored issues
–
show
Coding Style
introduced
by
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
|
|||||||
14 | { |
||||||
15 | |||||||
16 | 6 | public function validator(ValidationFactory $factory) |
|||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
28 | { |
||||||
29 | $validator->sometimes('role', app(UserIsNotLoggedIntoRole::class), function($input) { |
||||||
0 ignored issues
–
show
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
Loading history...
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
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...
|
|||||||
30 | 6 | return app(Authentication::class)->getUser()->id() === (int) $this->route('user'); |
|||||
31 | 6 | }); |
|||||
0 ignored issues
–
show
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 | } |