Tustin / psn-php

A PHP wrapper for the PSN API
https://tustin.dev/psn-php/
MIT License
354 stars 73 forks source link

Change in : foreach ($trophyTitle->platform () as $platform) #237

Closed Reuns closed 1 year ago

Reuns commented 1 year ago

Since last update, when I tried to get the platform of a game

foreach ($trophyTitle->platform () as $platform) {
  var_dump ($platform);
}

I don't have PS5 anymore but

enum(Tustin\PlayStation\Enum\ConsoleType::PS5)

I don't understand what's the purpose to this. Is it a mistake ? Could you revert it back please ? @Tustin

Thanks

Tustin commented 1 year ago

I switched from using a 3rd party enum library to using native enums that were added in PHP 8.1. They should be working identically to the old version. Are you trying to store that value somewhere?

Reuns commented 1 year ago

I'm getting to store it yes.

But I don't know how to use this enum system. I have a fatal error on my script, on this line $platforms .= $virg.$platform;

Fatal error: Uncaught Error: Object of class Tustin\PlayStation\Enum\ConsoleType could not be converted to string in [...]

Tustin commented 1 year ago

Try using $platform->value. This should return the string that you are expecting.

Reuns commented 1 year ago

As simple as that ... I feel so ashamed to bother you with that kind of question.

It works perfectly. Everything else seems to work well too !

Once again : thank you for your help.

Tustin commented 1 year ago

No worries. It's my fault for randomly changing the format 😛. Glad I could help.