Skip to content

Commit 5475557

Browse files
committed
run rector
1 parent 26d5593 commit 5475557

103 files changed

Lines changed: 252 additions & 407 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/Console/Commands/Invitation/Create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Create extends Command {
1717
*/
1818
public function handle() {
1919
$code = trim($this->argument('code'));
20-
$jobResult = (new InvitationCreateJob($code))->handle();
20+
$jobResult = new InvitationCreateJob($code)->handle();
2121

2222
if ($jobResult) {
2323
$this->line('Successfully created invitation: ' . $code);

app/Console/Commands/Invitation/CreateBulk.php

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

2323
for ($i = 0; $i < $numCodes; $i++) {
2424
$code = $helper->generate();
25-
$jobResult = (new InvitationCreateJob($code))->handle();
25+
$jobResult = new InvitationCreateJob($code)->handle();
2626

2727
if ($jobResult) {
2828
$this->line('Successfully created invitation: ' . $code);

app/Console/Commands/Invitation/Delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Delete extends Command {
1717
*/
1818
public function handle() {
1919
$code = trim($this->argument('code'));
20-
(new InvitationDeleteJob($code))->handle();
20+
new InvitationDeleteJob($code)->handle();
2121

2222
return 0;
2323
}

app/Console/Commands/RebuildQueryserviceData.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private function getEntitiesForWiki(Wiki $wiki): array {
9393
: [];
9494

9595
$merged = array_merge($items, $properties, $lexemes);
96-
$this->stripPrefixes($merged);
96+
self::stripPrefixes($merged);
9797

9898
return $merged;
9999
}
@@ -111,7 +111,7 @@ private function getSparqlUrl(Wiki $wiki): string {
111111

112112
private static function stripPrefixes(array &$items): void {
113113
foreach ($items as &$item) {
114-
$e = explode(':', $item);
114+
$e = explode(':', (string) $item);
115115
$item = end($e);
116116
}
117117
}

app/Console/Kernel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Kernel extends ConsoleKernel {
2424
/**
2525
* Define the application's command schedule.
2626
*/
27+
#[\Override]
2728
protected function schedule(Schedule $schedule): void {
2829
// Make sure that the DB and QS pools are always populated somewhat.
2930
// This will create at most 1 new entry for each per minute...
@@ -66,6 +67,7 @@ protected function schedule(Schedule $schedule): void {
6667
/**
6768
* Register the commands for the application.
6869
*/
70+
#[\Override]
6971
protected function commands(): void {
7072
$this->load(__DIR__ . '/Commands');
7173
$this->load(__DIR__ . '/Commands/User');

app/Exceptions/Handler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Handler extends ExceptionHandler {
2020
/**
2121
* Register the exception handling callbacks for the application.
2222
*/
23+
#[\Override]
2324
public function register(): void {
2425
$this->reportable(function (Throwable $e): void {
2526
(new ErrorReporting)->report($e);

app/Helper/DomainValidator.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@
66
use Illuminate\Support\Facades\Validator;
77

88
class DomainValidator {
9-
public array $subdomainRules;
10-
11-
public string $subDomainSuffix;
12-
13-
public function __construct(string $subDomainSuffix, array $subdomainRules) {
14-
$this->subDomainSuffix = $subDomainSuffix;
15-
$this->subdomainRules = $subdomainRules;
9+
public function __construct(public string $subDomainSuffix, public array $subdomainRules)
10+
{
1611
}
1712

1813
public function getValidator($domain): \Illuminate\Contracts\Validation\Validator {

app/Helper/ElasticSearchHelper.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@
55
use App\Http\Curl\HttpRequest;
66

77
class ElasticSearchHelper {
8-
private $elasticSearchHost;
9-
10-
private $elasticSearchBaseName;
11-
12-
public function __construct(string $elasticSearchHost, string $elasticSearchBaseName) {
13-
$this->elasticSearchHost = $elasticSearchHost;
14-
$this->elasticSearchBaseName = $elasticSearchBaseName;
8+
public function __construct(private readonly string $elasticSearchHost, private readonly string $elasticSearchBaseName)
9+
{
1510
}
1611

1712
public function hasIndices(HttpRequest $request): bool {
@@ -44,7 +39,7 @@ public function hasIndices(HttpRequest $request): bool {
4439
// index\n
4540
// site1.localhost_content_blabla\n
4641
// site1.localhost_general_bla\n
47-
$wikiIndices = array_filter(explode("\n", $rawResponse));
42+
$wikiIndices = array_filter(explode("\n", (string) $rawResponse));
4843

4944
// no indices to delete only index header
5045
if (count($wikiIndices) <= 1) {

app/Helper/InviteHelper.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,17 @@
33
namespace App\Helper;
44

55
class InviteHelper {
6-
private $segments;
7-
8-
private $segmentLength;
9-
106
private $prefix;
117

12-
public function __construct(int $numSegments = 2, int $segmentLength = 4) {
8+
public function __construct(private readonly int $segments = 2, private readonly int $segmentLength = 4) {
139
$this->prefix = 'wbcloud-';
14-
$this->segments = $numSegments;
15-
$this->segmentLength = $segmentLength;
1610
}
1711

1812
private function generateSegment(int &$counter): string {
1913
$segment = '';
2014

2115
for ($i = 0; $i < $this->segmentLength; $i++) {
22-
$segment .= rand(0, 9);
16+
$segment .= random_int(0, 9);
2317
}
2418

2519
$counter++;

app/Helper/MWTimestampHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Carbon\Exceptions\InvalidFormatException;
1313

1414
class MWTimestampHelper {
15-
private const MWTimestampFormat = 'YmdHis';
15+
private const string MWTimestampFormat = 'YmdHis';
1616

1717
public static function getCarbonFromMWTimestamp(string $MWTimestamp): CarbonImmutable {
1818
$carbon = CarbonImmutable::createFromFormat(self::MWTimestampFormat, $MWTimestamp);

0 commit comments

Comments
 (0)