Skip to content

Commit 3ce50e9

Browse files
committed
level 5
1 parent 7f70d1b commit 3ce50e9

File tree

11 files changed

+26
-15
lines changed

11 files changed

+26
-15
lines changed

app/Helpers/FTP.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class FTP
88
{
9-
public function connect(string $host, string $port, bool $ssl = false): bool|Connection
9+
public function connect(string $host, int $port, bool $ssl = false): bool|Connection
1010
{
1111
if ($ssl) {
1212
return ftp_ssl_connect($host, $port, 5);

app/Models/Backup.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ public static function boot(): void
4646
{
4747
parent::boot();
4848

49-
static::deleting(function (Backup $backup) {
50-
$backup->files()->each(function (BackupFile $file) {
49+
static::deleting(function ($backup) {
50+
/** @var Backup $backup */
51+
$backup->files()->each(function ($file) {
52+
/** @var BackupFile $file */
5153
$file->delete();
5254
});
5355
});

app/Models/Database.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public static function boot(): void
4141
parent::boot();
4242

4343
static::deleting(function (Database $database) {
44-
$database->server->databaseUsers()->each(function (DatabaseUser $user) use ($database) {
44+
$database->server->databaseUsers()->each(function ($user) use ($database) {
45+
/** @var DatabaseUser $user */
4546
$databases = $user->databases;
4647
if ($databases && in_array($database->name, $databases)) {
4748
unset($databases[array_search($database->name, $databases)]);

app/Models/Project.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public static function boot(): void
3838
parent::boot();
3939

4040
static::deleting(function (Project $project) {
41-
$project->servers()->each(function (Server $server) {
41+
$project->servers()->each(function ($server) {
42+
/** @var Server $server */
4243
$server->delete();
4344
});
4445
});

app/Models/Server.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @property string $name
3232
* @property string $ssh_user
3333
* @property string $ip
34-
* @property string $local_ip
34+
* @property ?string $local_ip
3535
* @property int $port
3636
* @property string $os
3737
* @property string $type
@@ -122,14 +122,16 @@ public static function boot(): void
122122
static::deleting(function (Server $server) {
123123
DB::beginTransaction();
124124
try {
125-
$server->sites()->each(function (Site $site) {
125+
$server->sites()->each(function ($site) {
126+
/** @var Site $site */
126127
$site->queues()->delete();
127128
$site->ssls()->delete();
128129
$site->deployments()->delete();
129130
$site->deploymentScript()->delete();
130131
});
131132
$server->sites()->delete();
132-
$server->logs()->each(function (ServerLog $log) {
133+
$server->logs()->each(function ($log) {
134+
/** @var ServerLog $log */
133135
$log->delete();
134136
});
135137
$server->services()->delete();

app/Models/Site.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ public static function boot(): void
100100
parent::boot();
101101

102102
static::deleting(function (Site $site) {
103-
$site->queues()->each(fn (Queue $queue) => $queue->delete());
103+
$site->queues()->each(function ($queue) {
104+
/** @var Queue $queue */
105+
$queue->delete();
106+
});
104107
$site->ssls()->delete();
105108
$site->deployments()->delete();
106109
$site->deploymentScript()->delete();

app/ServerProviders/Custom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function create(): void
6363
$storageDisk = Storage::disk(config('core.key_pairs_disk'));
6464
File::copy(
6565
storage_path(config('core.ssh_private_key_name')),
66-
$storageDisk->path($this->server->id)
66+
$storageDisk->path((string) $this->server->id)
6767
);
6868
File::copy(
6969
storage_path(config('core.ssh_public_key_name')),

app/ServerProviders/Hetzner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function plans(?string $region): array
6767
->json();
6868

6969
return collect($plans['server_types'])->filter(function ($type) use ($region) {
70-
return collect($type['prices'])->filter(function ($price) use ($region) {
70+
return collect($type['prices'])->contains(function ($price) use ($region) {
7171
return $price['location'] === $region;
7272
});
7373
})

app/Web/Pages/Servers/Sites/Widgets/LoadBalancerServers.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ public function form(Form $form): Form
8888
->options(function () {
8989
return $this->site->project->servers()
9090
->where('id', '!=', $this->site->server_id)
91+
->whereNotNull('local_ip')
9192
->get()
92-
->mapWithKeys(function (Server $server) {
93-
return [$server->local_ip => $server->name.' ('.$server->local_ip.')'];
93+
->mapWithKeys(function ($server) {
94+
/** @var Server $server */
95+
return $server->local_ip ? [$server->local_ip => $server->name.' ('.$server->local_ip.')'] : [];
9496
});
9597
}),
9698
TextInput::make('port')

app/Web/Pages/Servers/Widgets/ServerDetails.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function infolist(Infolist $infolist): Infolist
6363
Notification::make()
6464
->info()
6565
->title('Available updates:')
66-
->body($record->updates)
66+
->body((string) $record->updates)
6767
->send();
6868
})
6969
),

0 commit comments

Comments
 (0)