Skip to content

Commit 9101125

Browse files
authored
Add rector config and fixes (#1125)
``` dc exec -it --user "$(id -u):$(id -g)" api vendor/bin/rector process ``` Bug: T426177
1 parent f79ca7f commit 9101125

37 files changed

Lines changed: 349 additions & 97 deletions

app/Console/Commands/ScheduleStatsUpdates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function handle() {
5151

5252
Bus::batch($siteStatsUpdateJobs)
5353
->allowFailures()
54-
->finally(function () {
54+
->finally(function (): void {
5555
dispatch(new PlatformStatsSummaryJob);
5656
})->dispatch();
5757

app/Exceptions/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Handler extends ExceptionHandler {
2121
* Register the exception handling callbacks for the application.
2222
*/
2323
public function register(): void {
24-
$this->reportable(function (Throwable $e) {
24+
$this->reportable(function (Throwable $e): void {
2525
(new ErrorReporting)->report($e);
2626
});
2727
}

app/Helper/DomainValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function __construct(string $subDomainSuffix, array $subdomainRules) {
1515
$this->subdomainRules = $subdomainRules;
1616
}
1717

18-
public function getValidator($domain): \Illuminate\Validation\Validator {
18+
public function getValidator($domain): \Illuminate\Contracts\Validation\Validator {
1919

2020
$isSubdomain = WikiController::isSubDomain($domain, $this->subDomainSuffix);
2121

app/Helper/ProfileValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Support\Facades\Validator;
66

77
class ProfileValidator {
8-
public function getValidator($profile): \Illuminate\Validation\Validator {
8+
public function getValidator($profile): \Illuminate\Contracts\Validation\Validator {
99

1010
return Validator::make($profile, [
1111
'purpose' => 'in:data_hub,data_lab,tool_lab,test_drive,decide_later,other',

app/Http/Controllers/Auth/ForgotPasswordController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use App\Http\Controllers\Controller;
66
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
77
use Illuminate\Http\JsonResponse;
8+
use Illuminate\Http\Request;
89

910
class ForgotPasswordController extends Controller {
1011
/*
@@ -29,7 +30,7 @@ public function __construct() {
2930
$this->middleware('guest');
3031
}
3132

32-
protected function sendResetLinkResponse(): JsonResponse {
33+
protected function sendResetLinkResponse(?Request $request = null): JsonResponse {
3334
return response()->json('Success', 200);
3435
}
3536

app/Http/Controllers/Auth/RegisterController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function register(Request $request) {
3232
$this->validator($request->all())->validate();
3333

3434
$user = null;
35-
DB::transaction(function () use (&$user, $request) {
35+
DB::transaction(function () use (&$user, $request): void {
3636
$user = (new UserCreateJob(
3737
$request->input('email'),
3838
$request->input('password')

app/Http/Controllers/Auth/ResetPasswordController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use App\Http\Controllers\Controller;
66
use Illuminate\Foundation\Auth\ResetsPasswords;
77
use Illuminate\Http\JsonResponse;
8+
use Illuminate\Http\Request;
89

910
class ResetPasswordController extends Controller {
1011
/*
@@ -36,7 +37,7 @@ public function __construct() {
3637
$this->middleware('guest');
3738
}
3839

39-
protected function sendResetResponse(): JsonResponse {
40+
protected function sendResetResponse(?Request $request = null): JsonResponse {
4041
return response()->json('Success', 200);
4142
}
4243

app/Http/Controllers/ComplaintController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function sendMessage(Request $request): JsonResponse {
8080
/**
8181
* Get a validator for an incoming complaint report page request.
8282
*/
83-
protected function validator(array $data): \Illuminate\Validation\Validator {
83+
protected function validator(array $data): \Illuminate\Contracts\Validation\Validator {
8484
$data['name'] = $data['name'] ?? '';
8585
$data['email'] = $data['email'] ?? '';
8686

app/Http/Controllers/ContactController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function sendMessage(Request $request): JsonResponse {
5555
/**
5656
* Get a validator for an incoming contact page request.
5757
*/
58-
protected function validator(array $data): \Illuminate\Validation\Validator {
58+
protected function validator(array $data): \Illuminate\Contracts\Validation\Validator {
5959
if (!isset($data['contactDetails'])) {
6060
$data['contactDetails'] = ''; // could we skip this using some feature of the validator?
6161
}

app/Http/Controllers/Sandbox/SandboxController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function create(Request $request): Response {
3737
$dataSet = $request->get('dataSet');
3838

3939
$wiki = null;
40-
DB::transaction(function () use (&$wiki, $domain) {
40+
DB::transaction(function () use (&$wiki, $domain): void {
4141
$wikiDbCondition = ['wiki_id' => null, 'version' => self::MW_VERSION];
4242

4343
// Fail if there is not enough storage ready

0 commit comments

Comments
 (0)