File tree Expand file tree Collapse file tree 2 files changed +4
-46
lines changed Expand file tree Collapse file tree 2 files changed +4
-46
lines changed Original file line number Diff line number Diff line change @@ -266,16 +266,16 @@ public function addMyShows(string|array $shows): bool
266266 *
267267 * @return bool Whether the tracks was successfully added.
268268 */
269- public function addMyTracks (string | array |object $ tracks ): bool
269+ public function addMyTracks (array |object $ tracks ): bool
270270 {
271- $ tracks = is_object ( $ tracks ) ? ( array ) $ tracks : $ tracks ;
271+ $ tracks = ( array ) $ tracks ;
272272
273- if (is_array ( $ tracks ) && isset ($ tracks ['ids ' ])) {
273+ if (isset ($ tracks ['ids ' ])) {
274274 $ tracks = (array ) $ this ->uriToId ($ tracks ['ids ' ], 'track ' );
275275 $ options = json_encode ([
276276 'ids ' => $ tracks ,
277277 ]);
278- } elseif (is_array ( $ tracks ) && isset ($ tracks ['timestamped_ids ' ])) {
278+ } elseif (isset ($ tracks ['timestamped_ids ' ])) {
279279 $ tracks = array_map (function ($ item ) {
280280 $ item ['id ' ] = $ this ->uriToId ($ item ['id ' ], 'track ' );
281281
@@ -285,17 +285,6 @@ public function addMyTracks(string|array|object $tracks): bool
285285 $ options = json_encode ([
286286 'timestamped_ids ' => $ tracks ,
287287 ]);
288- } else {
289- trigger_error (
290- // phpcs:ignore
291- 'Passing string or array without "ids" or "timestamped_ids" key to SpotifyWebAPI::addMyTracks() is deprecated ' ,
292- E_USER_DEPRECATED
293- );
294-
295- $ tracks = (array ) $ this ->uriToId ($ tracks , 'track ' );
296- $ options = json_encode ([
297- 'ids ' => $ tracks ,
298- ]);
299288 }
300289
301290 $ headers = [
Original file line number Diff line number Diff line change @@ -280,37 +280,6 @@ public function testAddMyTracksTimestampedIds()
280280 );
281281 }
282282
283- public function testAddMyTracksDeprecated ()
284- {
285- $ tracks = [
286- '1id6H6vcwSB9GGv9NXh5cl ' ,
287- '3mqRLlD9j92BBv1ueFhJ1l ' ,
288- 'spotify:track:1id6H6vcwSB9GGv9NXh5cl ' ,
289- ];
290-
291- $ expected = json_encode ([
292- 'ids ' => [
293- '1id6H6vcwSB9GGv9NXh5cl ' ,
294- '3mqRLlD9j92BBv1ueFhJ1l ' ,
295- '1id6H6vcwSB9GGv9NXh5cl ' ,
296- ],
297- ]);
298-
299- $ headers = ['Content-Type ' => 'application/json ' ];
300- $ return = ['status ' => 200 ];
301- $ api = $ this ->setupApi (
302- 'PUT ' ,
303- '/v1/me/tracks ' ,
304- $ expected ,
305- $ headers ,
306- $ return
307- );
308-
309- $ this ->assertTrue (
310- $ api ->addMyTracks ($ tracks )
311- );
312- }
313-
314283 public function testAddPlaylistTracks ()
315284 {
316285 $ tracks = [
You can’t perform that action at this time.
0 commit comments