Skip to content

Commit

Permalink
chore: rector fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Jul 7, 2024
1 parent 689d1f1 commit 8f3be65
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/Rules/UniqueScheduledTimePerRemoteServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class UniqueScheduledTimePerRemoteServer implements ValidationRule
public function __construct(
public int $remoteServerId,
public ?int $taskId = null,
) {}
) {
}

public function validate(string $attribute, mixed $value, Closure $fail): void
{
Expand Down
5 changes: 3 additions & 2 deletions app/Services/Backup/Destinations/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class Local implements BackupDestinationInterface
public function __construct(
protected SFTPInterface $sftp,
protected string $storagePath
) {}
) {
}

/**
* @return array<string>
Expand Down Expand Up @@ -94,7 +95,7 @@ public function ensureDirectoryExists(string $path): bool

$listResult = $this->sftp->exec('ls -la ' . escapeshellarg($path));

if (! empty($listResult)) {
if (! ($listResult === false || ($listResult === '' || $listResult === '0'))) {
Log::info('Directory already exists', ['path' => $path]);

return true;
Expand Down
3 changes: 2 additions & 1 deletion app/Services/Backup/Destinations/S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class S3 implements BackupDestinationInterface
public function __construct(
protected S3Client $client,
protected string $bucketName
) {}
) {
}

/**
* @return array<string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
->assertHasErrors(['port']);
});

test('username is set correctly after provider method called', function () {
test('username is set correctly after provider method called', function (): void {
Toaster::fake();

$component = Livewire::test(CreateRemoteServerForm::class)
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Services/Backup/Destinations/LocalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
$this->mockLocal->shouldReceive('ensureDirectoryExists')->andReturn(true);
$this->mockSftp->shouldReceive('mkdir')->andReturn(true);
$this->mockSftp->shouldReceive('getLastError')->andReturn('');
$this->mockSftp->shouldReceive('exec')->withArgs(function ($command) {
$this->mockSftp->shouldReceive('exec')->withArgs(function ($command): bool {
return str_starts_with($command, 'ls -la ');
})->andReturn('');
});
Expand All @@ -84,7 +84,7 @@

Log::shouldReceive('info');
Log::shouldReceive('warning')->atLeast()->once()->withAnyArgs();
Log::shouldReceive('error')->atLeast()->once()->withArgs(function ($message) {
Log::shouldReceive('error')->atLeast()->once()->withArgs(function ($message): bool {
return str_contains($message, 'Failed to stream file to remote local storage');
});

Expand Down

0 comments on commit 8f3be65

Please sign in to comment.