Skip to content

Commit 2988cfc

Browse files
style: bump mago to latest
1 parent 0293f5e commit 2988cfc

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

+287
-453
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"orchestra/testbench": "^9.0",
1818
"pestphp/pest": "^3.0",
1919
"pestphp/pest-plugin-laravel": "^3.0",
20-
"carthage-software/mago": "^0.11.0"
20+
"carthage-software/mago": "^0.22.2"
2121
},
2222
"autoload": {
2323
"psr-4": {

composer.lock

Lines changed: 13 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mago.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ paths = ["src", "tests"]
33
includes = ["vendor"]
44

55
[format]
6-
method_chain_break_threshold = 2
76
null_type_hint = "question"
87

8+
[linter]
9+
default_plugins = true
10+
plugins = ["laravel"]
11+
912
[[linter.rules]]
1013
name = "strictness/require-return-type"
1114
ignore_arrow_function = true

src/Backuper.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
use Illuminate\Support\Facades\File;
88
use Illuminate\Support\Facades\Pipeline;
99
use Itiden\Backup\Contracts\Repositories\BackupRepository;
10-
use Itiden\Backup\Support\Zipper;
1110
use Itiden\Backup\DataTransferObjects\BackupDto;
1211
use Itiden\Backup\Enums\State;
1312
use Itiden\Backup\Events\BackupCreated;
1413
use Itiden\Backup\Events\BackupFailed;
1514
use Itiden\Backup\Models\Metadata;
15+
use Itiden\Backup\Support\Zipper;
1616
use Throwable;
1717

1818
use function Illuminate\Filesystem\join_paths;
@@ -22,8 +22,7 @@ final class Backuper
2222
public function __construct(
2323
private BackupRepository $repository,
2424
private StateManager $stateManager,
25-
) {
26-
}
25+
) {}
2726

2827
/**
2928
* Create a new backup.

src/Console/Commands/BackupCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
use Itiden\Backup\DataTransferObjects\BackupDto;
99
use Itiden\Backup\Facades\Backuper;
1010

11-
use function Laravel\Prompts\{info, spin};
11+
use function Laravel\Prompts\info;
12+
use function Laravel\Prompts\spin;
1213

1314
/**
1415
* Backup site

src/Console/Commands/RestoreCommand.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
use Itiden\Backup\DataTransferObjects\BackupDto;
1010
use Itiden\Backup\Facades\Restorer;
1111

12-
use function Laravel\Prompts\{confirm, spin, info, select};
12+
use function Laravel\Prompts\confirm;
13+
use function Laravel\Prompts\info;
14+
use function Laravel\Prompts\select;
15+
use function Laravel\Prompts\spin;
1316

1417
/**
1518
* Restore content from a directory / backup
@@ -31,27 +34,21 @@ public function handle(BackupRepository $repo): void
3134
(string) filesize($this->option('path')),
3235
$this->option('path'),
3336
),
34-
default
35-
=> BackupDto::fromFile(select(
37+
default => BackupDto::fromFile(select(
3638
label: 'Which backup do you want to restore to?',
3739
scroll: 10,
38-
options: $repo
39-
->all()
40-
->flatMap(static fn(BackupDto $backup): array => [$backup->path => $backup->path]),
40+
options: $repo->all()->flatMap(static fn(BackupDto $backup): array => [$backup->path => $backup->path]),
4141
required: true,
4242
)),
4343
};
4444

45-
if (
46-
$this->option('force') ||
47-
confirm(
48-
label: 'Are you sure you want to restore your content?',
49-
hint: "This will overwrite your current content with state from {$backup->created_at->format(
50-
'Y-m-d H:i:s',
51-
)}",
52-
required: true,
53-
)
54-
) {
45+
if ($this->option('force') || confirm(
46+
label: 'Are you sure you want to restore your content?',
47+
hint: "This will overwrite your current content with state from {$backup->created_at->format(
48+
'Y-m-d H:i:s',
49+
)}",
50+
required: true,
51+
)) {
5552
spin(static fn() => Restorer::restore($backup), 'Restoring backup');
5653

5754
info('Backup restored!');

src/DataTransferObjects/BackupDto.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public function __construct(
1919
public CarbonImmutable $created_at,
2020
public string $size,
2121
public string $path,
22-
) {
23-
}
22+
) {}
2423

2524
public function getMetadata(): Metadata
2625
{

src/DataTransferObjects/ChunkyTestDto.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public function __construct(
1212
public string $identifier,
1313
public string $filename,
1414
public int $currentChunk,
15-
) {
16-
}
15+
) {}
1716

1817
/**
1918
* Create a new ChunkyTestDto from a request

src/DataTransferObjects/ChunkyUploadDto.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@
99

1010
final readonly class ChunkyUploadDto
1111
{
12-
// @mago-ignore maintainability/excessive-parameter-list
12+
// @mago-expect maintainability/excessive-parameter-list
1313
public function __construct(
1414
public string $filename,
1515
public int $totalChunks,
1616
public int $currentChunk,
1717
public int $totalSize,
1818
public string $identifier,
1919
public UploadedFile $file,
20-
) {
21-
}
20+
) {}
2221

2322
/**
2423
* Create a new ChunkyUploadDto from a request

src/DataTransferObjects/ResolvedBackupData.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ public function __construct(
1212
public CarbonImmutable $createdAt,
1313
public string $id,
1414
public string $name,
15-
) {
16-
}
15+
) {}
1716
}

0 commit comments

Comments
 (0)