diff --git a/app/Console/Commands/Storage/SetupDropboxStorageCommand.php b/app/Console/Commands/Storage/SetupDropboxStorageCommand.php index 36a9a8e9..929aa96c 100644 --- a/app/Console/Commands/Storage/SetupDropboxStorageCommand.php +++ b/app/Console/Commands/Storage/SetupDropboxStorageCommand.php @@ -55,7 +55,7 @@ class SetupDropboxStorageCommand extends Command $accessCode = $this->ask('Enter the access code'); $response = Http::asForm() - ->withBasicAuth($appKey, $appSecret) + ->withBasicAuth($config['DROPBOX_APP_KEY'], $config['DROPBOX_APP_SECRET']) ->post('https://api.dropboxapi.com/oauth2/token', [ 'code' => $accessCode, 'grant_type' => 'authorization_code', diff --git a/app/Exceptions/UnsupportedSongStorageTypeException.php b/app/Exceptions/UnsupportedSongStorageTypeException.php index 9ee7e3e2..93958760 100644 --- a/app/Exceptions/UnsupportedSongStorageTypeException.php +++ b/app/Exceptions/UnsupportedSongStorageTypeException.php @@ -11,7 +11,7 @@ class UnsupportedSongStorageTypeException extends Exception parent::__construct("Unsupported song storage type: $storageType"); } - public function create(string $storageType): self + public static function create(string $storageType): self { return new self($storageType); } diff --git a/app/Http/Controllers/API/PlaylistCollaboration/PlaylistCollaboratorController.php b/app/Http/Controllers/API/PlaylistCollaboration/PlaylistCollaboratorController.php index 70a2ca58..65aa3320 100644 --- a/app/Http/Controllers/API/PlaylistCollaboration/PlaylistCollaboratorController.php +++ b/app/Http/Controllers/API/PlaylistCollaboration/PlaylistCollaboratorController.php @@ -15,7 +15,6 @@ use Illuminate\Http\Response; class PlaylistCollaboratorController extends Controller { - /** @param User $user */ public function __construct(private PlaylistCollaborationService $service, private UserRepository $userRepository) { } diff --git a/app/Models/Playlist.php b/app/Models/Playlist.php index e0eced09..704a603a 100644 --- a/app/Models/Playlist.php +++ b/app/Models/Playlist.php @@ -63,7 +63,8 @@ class Playlist extends Model public function songs(): BelongsToMany { - return $this->belongsToMany(Song::class)->withTimestamps() + return $this->belongsToMany(Song::class) + ->withTimestamps() ->withPivot('position') ->orderByPivot('position'); } @@ -160,7 +161,7 @@ class Playlist extends Model public function addSongs(Collection|Song|array $songs, ?User $collaborator = null): void { $collaborator ??= $this->user; - $maxPosition = $this->songs()->max('position') ?? 0; + $maxPosition = $this->songs()->getQuery()->max('position') ?? 0; if (!is_array($songs)) { $songs = Collection::wrap($songs)->pluck('id')->all(); diff --git a/app/Services/Streamer/Streamer.php b/app/Services/Streamer/Streamer.php index 0792e337..999a1cb3 100644 --- a/app/Services/Streamer/Streamer.php +++ b/app/Services/Streamer/Streamer.php @@ -39,7 +39,7 @@ class Streamer SongStorageTypes::LOCAL, '' => app(LocalStreamerAdapter::class), SongStorageTypes::S3, SongStorageTypes::S3_LAMBDA => app(S3CompatibleStreamerAdapter::class), SongStorageTypes::DROPBOX => app(DropboxStreamerAdapter::class), - default => throw UnsupportedSongStorageTypeException::make($this->song->storage), + default => throw UnsupportedSongStorageTypeException::create($this->song->storage), }; } diff --git a/app/Values/Equalizer.php b/app/Values/Equalizer.php index 44c60e2b..e1da2436 100644 --- a/app/Values/Equalizer.php +++ b/app/Values/Equalizer.php @@ -9,7 +9,7 @@ use Throwable; final class Equalizer implements Arrayable { /** @param array|null $gains */ - private function __construct(public ?string $name, public int $preamp, public array $gains) + private function __construct(public ?string $name, public ?int $preamp, public ?array $gains) { } diff --git a/tests/Feature/KoelPlus/AlbumCoverTest.php b/tests/Feature/KoelPlus/AlbumCoverTest.php index efca63d7..77560bdf 100644 --- a/tests/Feature/KoelPlus/AlbumCoverTest.php +++ b/tests/Feature/KoelPlus/AlbumCoverTest.php @@ -6,6 +6,7 @@ use App\Models\Album; use App\Models\Song; use App\Services\MediaMetadataService; use Mockery; +use Mockery\MockInterface; use Tests\PlusTestCase; use function Tests\create_admin; @@ -13,6 +14,8 @@ use function Tests\create_user; class AlbumCoverTest extends PlusTestCase { + private MediaMetadataService|MockInterface $mediaMetadataService; + public function setUp(): void { parent::setUp(); diff --git a/tests/Integration/KoelPlus/Services/SongStorages/DropboxStorageTest.php b/tests/Integration/KoelPlus/Services/SongStorages/DropboxStorageTest.php index e9314a62..f6a6272c 100644 --- a/tests/Integration/KoelPlus/Services/SongStorages/DropboxStorageTest.php +++ b/tests/Integration/KoelPlus/Services/SongStorages/DropboxStorageTest.php @@ -40,7 +40,7 @@ class DropboxStorageTest extends PlusTestCase $this->client = $this->mock(Client::class); $this->filesystem = $this->mock(DropboxFilesystem::class); - $this->filesystem->allows('getAdapter')->andReturns( + $this->filesystem->allows('getAdapter')->andReturn( Mockery::mock(DropboxAdapter::class, ['getClient' => $this->client]) );