Skip to content

Commit 5b67271

Browse files
freekmurzegithub-actions[bot]
authored andcommitted
Fix styling
1 parent 98b8b73 commit 5b67271

Some content is hidden

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

53 files changed

+126
-156
lines changed

src/BackupDestination/BackupCollection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class BackupCollection extends Collection
1313
public static function createFromFiles(?FileSystem $disk, array $files): self
1414
{
1515
return (new static($files))
16-
->filter(fn (string $path) => (new File())->isZipFile($disk, $path))
16+
->filter(fn (string $path) => (new File)->isZipFile($disk, $path))
1717
->map(fn (string $path) => new Backup($disk, $path))
1818
->sortByDesc(fn (Backup $backup) => $backup->date()->timestamp)
1919
->values();

src/BackupDestination/BackupDestination.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class BackupDestination
2020

2121
protected ?BackupCollection $backupCollectionCache = null;
2222

23-
public function __construct(Filesystem $disk = null, string $backupName, string $diskName)
23+
public function __construct(?Filesystem $disk, string $backupName, string $diskName)
2424
{
2525
$this->disk = $disk;
2626

src/BackupServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function registerDiscordChannel()
5656
{
5757
Notification::resolved(function (ChannelManager $service) {
5858
$service->extend('discord', function ($app) {
59-
return new DiscordChannel();
59+
return new DiscordChannel;
6060
});
6161
});
6262
}

src/Commands/ListCommand.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ListCommand extends BaseCommand
2020
public function handle(): int
2121
{
2222
if (config()->has('backup.monitorBackups')) {
23-
$this->warn("Warning! Your config file still uses the old monitorBackups key. Update it to monitor_backups.");
23+
$this->warn('Warning! Your config file still uses the old monitorBackups key. Update it to monitor_backups.');
2424
}
2525

2626
$statuses = BackupDestinationStatusFactory::createForMonitorConfig(config('backup.monitor_backups'));
@@ -39,8 +39,8 @@ protected function displayOverview(Collection $backupDestinationStatuses)
3939
});
4040

4141
$this->table($headers, $rows, 'default', [
42-
4 => new RightAlignedTableStyle(),
43-
6 => new RightAlignedTableStyle(),
42+
4 => new RightAlignedTableStyle,
43+
6 => new RightAlignedTableStyle,
4444
]);
4545

4646
return $this;
@@ -98,7 +98,7 @@ protected function displayFailures(Collection $backupDestinationStatuses)
9898
return $this;
9999
}
100100

101-
protected function getFormattedBackupDate(Backup $backup = null)
101+
protected function getFormattedBackupDate(?Backup $backup = null)
102102
{
103103
return is_null($backup)
104104
? 'No backups present'

src/Commands/MonitorCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MonitorCommand extends BaseCommand implements Isolatable
1818
public function handle(): int
1919
{
2020
if (config()->has('backup.monitorBackups')) {
21-
$this->warn("Warning! Your config file still uses the old monitorBackups key. Update it to monitor_backups.");
21+
$this->warn('Warning! Your config file still uses the old monitorBackups key. Update it to monitor_backups.');
2222
}
2323

2424
$hasError = false;

src/Events/BackupHasFailed.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ class BackupHasFailed
1010
public function __construct(
1111
public Exception $exception,
1212
public ?BackupDestination $backupDestination = null,
13-
) {
14-
}
13+
) {}
1514
}

src/Events/BackupManifestWasCreated.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ class BackupManifestWasCreated
88
{
99
public function __construct(
1010
public Manifest $manifest,
11-
) {
12-
}
11+
) {}
1312
}

src/Events/BackupWasSuccessful.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ class BackupWasSuccessful
88
{
99
public function __construct(
1010
public BackupDestination $backupDestination,
11-
) {
12-
}
11+
) {}
1312
}

src/Events/BackupZipWasCreated.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ class BackupZipWasCreated
66
{
77
public function __construct(
88
public string $pathToZip,
9-
) {
10-
}
9+
) {}
1110
}

src/Events/CleanupHasFailed.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ class CleanupHasFailed
1010
public function __construct(
1111
public Exception $exception,
1212
public ?BackupDestination $backupDestination = null,
13-
) {
14-
}
13+
) {}
1514
}

src/Events/CleanupWasSuccessful.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ class CleanupWasSuccessful
88
{
99
public function __construct(
1010
public BackupDestination $backupDestination,
11-
) {
12-
}
11+
) {}
1312
}

src/Events/DumpingDatabase.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ class DumpingDatabase
88
{
99
public function __construct(
1010
public DbDumper $dbDumper
11-
) {
12-
}
11+
) {}
1312
}

src/Events/HealthyBackupWasFound.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ class HealthyBackupWasFound
88
{
99
public function __construct(
1010
public BackupDestinationStatus $backupDestinationStatus,
11-
) {
12-
}
11+
) {}
1312
}

src/Events/UnhealthyBackupWasFound.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ class UnhealthyBackupWasFound
88
{
99
public function __construct(
1010
public BackupDestinationStatus $backupDestinationStatus
11-
) {
12-
}
11+
) {}
1312
}

src/Exceptions/CannotCreateDbDumper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class CannotCreateDbDumper extends Exception
88
{
99
public static function unsupportedDriver(string $driver): self
1010
{
11-
$supportedDrivers = collect(config("database.connections"))->keys();
11+
$supportedDrivers = collect(config('database.connections'))->keys();
1212

1313
$formattedSupportedDrivers = $supportedDrivers
1414
->map(fn (string $supportedDriver) => "`$supportedDriver`")

src/Helpers/ConsoleOutput.php

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/**
88
* @phpstan-ignore-next-line
9+
*
910
* @mixin \Illuminate\Console\Concerns\InteractsWithIO
1011
*/
1112
class ConsoleOutput

src/Helpers/File.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function hasAllowedMimeType(?Filesystem $disk, string $path): bool
3232
return in_array($this->mimeType($disk, $path), self::$allowedMimeTypes);
3333
}
3434

35-
protected function mimeType(?Filesystem $disk, string $path): bool | string
35+
protected function mimeType(?Filesystem $disk, string $path): bool|string
3636
{
3737
try {
3838
if ($disk && method_exists($disk, 'mimeType')) {

src/Listeners/EncryptBackupArchive.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function handle(BackupZipWasCreated $event): void
1313
return;
1414
}
1515

16-
$zip = new ZipArchive();
16+
$zip = new ZipArchive;
1717

1818
$zip->open($event->pathToZip);
1919

src/Notifications/Channels/Discord/DiscordMessage.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
class DiscordMessage
88
{
99
public const COLOR_SUCCESS = '0b6623';
10+
1011
public const COLOR_WARNING = 'fD6a02';
12+
1113
public const COLOR_ERROR = 'e32929';
1214

1315
protected string $username = 'Laravel Backup';
@@ -28,7 +30,7 @@ class DiscordMessage
2830

2931
protected string $url = '';
3032

31-
public function from(string $username, string $avatarUrl = null): self
33+
public function from(string $username, ?string $avatarUrl = null): self
3234
{
3335
$this->username = $username;
3436

@@ -128,7 +130,7 @@ public function toArray(): array
128130
],
129131
];
130132

131-
if (!empty($this->username)) {
133+
if (! empty($this->username)) {
132134
$data['username'] = $this->username;
133135
}
134136

src/Notifications/EventHandler.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ class EventHandler
1717
{
1818
public function __construct(
1919
protected Repository $config
20-
) {
21-
}
20+
) {}
2221

2322
public function subscribe(Dispatcher $events): void
2423
{
@@ -40,7 +39,7 @@ protected function determineNotifiable()
4039

4140
protected function determineNotification($event): Notification
4241
{
43-
$lookingForNotificationClass = class_basename($event) . "Notification";
42+
$lookingForNotificationClass = class_basename($event).'Notification';
4443

4544
$notificationClass = collect($this->config->get('backup.notifications.notifications'))
4645
->keys()

src/Notifications/Notifiable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Notifiable
88
{
99
use NotifiableTrait;
1010

11-
public function routeNotificationForMail(): string | array
11+
public function routeNotificationForMail(): string|array
1212
{
1313
return config('backup.notifications.mail.to');
1414
}

src/Notifications/Notifications/BackupHasFailedNotification.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ class BackupHasFailedNotification extends BaseNotification
1313
{
1414
public function __construct(
1515
public BackupHasFailed $event,
16-
) {
17-
}
16+
) {}
1817

1918
public function toMail(): MailMessage
2019
{
21-
$mailMessage = (new MailMessage())
20+
$mailMessage = (new MailMessage)
2221
->error()
2322
->from(config('backup.notifications.mail.from.address', config('mail.from.address')), config('backup.notifications.mail.from.name', config('mail.from.name')))
2423
->subject(trans('backup::notifications.backup_failed_subject', ['application_name' => $this->applicationName()]))
@@ -33,7 +32,7 @@ public function toMail(): MailMessage
3332

3433
public function toSlack(): SlackMessage
3534
{
36-
return (new SlackMessage())
35+
return (new SlackMessage)
3736
->error()
3837
->from(config('backup.notifications.slack.username'), config('backup.notifications.slack.icon'))
3938
->to(config('backup.notifications.slack.channel'))
@@ -55,7 +54,7 @@ public function toSlack(): SlackMessage
5554

5655
public function toDiscord(): DiscordMessage
5756
{
58-
return (new DiscordMessage())
57+
return (new DiscordMessage)
5958
->error()
6059
->from(config('backup.notifications.discord.username'), config('backup.notifications.discord.avatar_url'))
6160
->title(trans('backup::notifications.backup_failed_subject', ['application_name' => $this->applicationName()]))

src/Notifications/Notifications/BackupWasSuccessfulNotification.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ class BackupWasSuccessfulNotification extends BaseNotification
1313
{
1414
public function __construct(
1515
public BackupWasSuccessful $event,
16-
) {
17-
}
16+
) {}
1817

1918
public function toMail(): MailMessage
2019
{
21-
$mailMessage = (new MailMessage())
20+
$mailMessage = (new MailMessage)
2221
->from(config('backup.notifications.mail.from.address', config('mail.from.address')), config('backup.notifications.mail.from.name', config('mail.from.name')))
2322
->subject(trans('backup::notifications.backup_successful_subject', ['application_name' => $this->applicationName()]))
2423
->line(trans('backup::notifications.backup_successful_body', ['application_name' => $this->applicationName(), 'disk_name' => $this->diskName()]));
@@ -32,7 +31,7 @@ public function toMail(): MailMessage
3231

3332
public function toSlack(): SlackMessage
3433
{
35-
return (new SlackMessage())
34+
return (new SlackMessage)
3635
->success()
3736
->from(config('backup.notifications.slack.username'), config('backup.notifications.slack.icon'))
3837
->to(config('backup.notifications.slack.channel'))
@@ -44,7 +43,7 @@ public function toSlack(): SlackMessage
4443

4544
public function toDiscord(): DiscordMessage
4645
{
47-
return (new DiscordMessage())
46+
return (new DiscordMessage)
4847
->success()
4948
->from(config('backup.notifications.discord.username'), config('backup.notifications.discord.avatar_url'))
5049
->title(trans('backup::notifications.backup_successful_subject_title'))

src/Notifications/Notifications/CleanupHasFailedNotification.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ class CleanupHasFailedNotification extends BaseNotification
1313
{
1414
public function __construct(
1515
public CleanupHasFailed $event,
16-
) {
17-
}
16+
) {}
1817

1918
public function toMail(): MailMessage
2019
{
21-
$mailMessage = (new MailMessage())
20+
$mailMessage = (new MailMessage)
2221
->error()
2322
->from(config('backup.notifications.mail.from.address', config('mail.from.address')), config('backup.notifications.mail.from.name', config('mail.from.name')))
2423
->subject(trans('backup::notifications.cleanup_failed_subject', ['application_name' => $this->applicationName()]))
@@ -35,7 +34,7 @@ public function toMail(): MailMessage
3534

3635
public function toSlack(): SlackMessage
3736
{
38-
return (new SlackMessage())
37+
return (new SlackMessage)
3938
->error()
4039
->from(config('backup.notifications.slack.username'), config('backup.notifications.slack.icon'))
4140
->to(config('backup.notifications.slack.channel'))
@@ -57,7 +56,7 @@ public function toSlack(): SlackMessage
5756

5857
public function toDiscord(): DiscordMessage
5958
{
60-
return (new DiscordMessage())
59+
return (new DiscordMessage)
6160
->error()
6261
->from(config('backup.notifications.discord.username'), config('backup.notifications.discord.avatar_url'))
6362
->title(

src/Notifications/Notifications/CleanupWasSuccessfulNotification.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ class CleanupWasSuccessfulNotification extends BaseNotification
1313
{
1414
public function __construct(
1515
public CleanupWasSuccessful $event,
16-
) {
17-
}
16+
) {}
1817

1918
public function toMail(): MailMessage
2019
{
21-
$mailMessage = (new MailMessage())
20+
$mailMessage = (new MailMessage)
2221
->from(config('backup.notifications.mail.from.address', config('mail.from.address')), config('backup.notifications.mail.from.name', config('mail.from.name')))
2322
->subject(trans('backup::notifications.cleanup_successful_subject', ['application_name' => $this->applicationName()]))
2423
->line(trans('backup::notifications.cleanup_successful_body', ['application_name' => $this->applicationName(), 'disk_name' => $this->diskName()]));
@@ -32,7 +31,7 @@ public function toMail(): MailMessage
3231

3332
public function toSlack(): SlackMessage
3433
{
35-
return (new SlackMessage())
34+
return (new SlackMessage)
3635
->success()
3736
->from(config('backup.notifications.slack.username'), config('backup.notifications.slack.icon'))
3837
->to(config('backup.notifications.slack.channel'))
@@ -44,7 +43,7 @@ public function toSlack(): SlackMessage
4443

4544
public function toDiscord(): DiscordMessage
4645
{
47-
return (new DiscordMessage())
46+
return (new DiscordMessage)
4847
->success()
4948
->from(config('backup.notifications.discord.username'), config('backup.notifications.discord.avatar_url'))
5049
->title(trans('backup::notifications.cleanup_successful_subject_title'))

src/Notifications/Notifications/HealthyBackupWasFoundNotification.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ class HealthyBackupWasFoundNotification extends BaseNotification
1313
{
1414
public function __construct(
1515
public HealthyBackupWasFound $event,
16-
) {
17-
}
16+
) {}
1817

1918
public function toMail(): MailMessage
2019
{
21-
$mailMessage = (new MailMessage())
20+
$mailMessage = (new MailMessage)
2221
->from(config('backup.notifications.mail.from.address', config('mail.from.address')), config('backup.notifications.mail.from.name', config('mail.from.name')))
2322
->subject(trans('backup::notifications.healthy_backup_found_subject', ['application_name' => $this->applicationName(), 'disk_name' => $this->diskName()]))
2423
->line(trans('backup::notifications.healthy_backup_found_body', ['application_name' => $this->applicationName()]));
@@ -32,7 +31,7 @@ public function toMail(): MailMessage
3231

3332
public function toSlack(): SlackMessage
3433
{
35-
return (new SlackMessage())
34+
return (new SlackMessage)
3635
->success()
3736
->from(config('backup.notifications.slack.username'), config('backup.notifications.slack.icon'))
3837
->to(config('backup.notifications.slack.channel'))
@@ -44,12 +43,12 @@ public function toSlack(): SlackMessage
4443

4544
public function toDiscord(): DiscordMessage
4645
{
47-
return (new DiscordMessage())
46+
return (new DiscordMessage)
4847
->success()
4948
->from(config('backup.notifications.discord.username'), config('backup.notifications.discord.avatar_url'))
5049
->title(
5150
trans('backup::notifications.healthy_backup_found_subject_title', [
52-
'application_name' => $this->applicationName(),
51+
'application_name' => $this->applicationName(),
5352
])
5453
)->fields($this->backupDestinationProperties()->toArray());
5554
}

0 commit comments

Comments
 (0)