diff --git a/app/Rules/UniqueScheduledTimePerRemoteServer.php b/app/Rules/UniqueScheduledTimePerRemoteServer.php index 8868f967..6df9cffb 100644 --- a/app/Rules/UniqueScheduledTimePerRemoteServer.php +++ b/app/Rules/UniqueScheduledTimePerRemoteServer.php @@ -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 { diff --git a/app/Services/Backup/Destinations/Local.php b/app/Services/Backup/Destinations/Local.php index b5c1e244..b6283855 100644 --- a/app/Services/Backup/Destinations/Local.php +++ b/app/Services/Backup/Destinations/Local.php @@ -19,7 +19,8 @@ class Local implements BackupDestinationInterface public function __construct( protected SFTPInterface $sftp, protected string $storagePath - ) {} + ) { + } /** * @return array @@ -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; diff --git a/app/Services/Backup/Destinations/S3.php b/app/Services/Backup/Destinations/S3.php index a5c9adf7..2d8e076f 100644 --- a/app/Services/Backup/Destinations/S3.php +++ b/app/Services/Backup/Destinations/S3.php @@ -25,7 +25,8 @@ class S3 implements BackupDestinationInterface public function __construct( protected S3Client $client, protected string $bucketName - ) {} + ) { + } /** * @return array diff --git a/tests/Feature/RemoteServers/Livewire/CreateRemoteServerFormTest.php b/tests/Feature/RemoteServers/Livewire/CreateRemoteServerFormTest.php index 1ea2d3ce..91257f2c 100644 --- a/tests/Feature/RemoteServers/Livewire/CreateRemoteServerFormTest.php +++ b/tests/Feature/RemoteServers/Livewire/CreateRemoteServerFormTest.php @@ -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) diff --git a/tests/Unit/Services/Backup/Destinations/LocalTest.php b/tests/Unit/Services/Backup/Destinations/LocalTest.php index 4978577e..fbfa480b 100644 --- a/tests/Unit/Services/Backup/Destinations/LocalTest.php +++ b/tests/Unit/Services/Backup/Destinations/LocalTest.php @@ -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(''); }); @@ -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'); });