klaviyo / php-klaviyo

PHP wrapper for the Klaviyo API
59 stars 48 forks source link

PHP 8.1 support - Klaviyo\Model\ProfileModel::jsonSerialize() #80

Closed samuelbelolo closed 2 years ago

samuelbelolo commented 2 years ago

👋🏻 Hello,

I have a deprecation warning :

Deprecated: Return type of Klaviyo\Model\ProfileModel::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in xxxx/xxxxx/vendor/klaviyo/php-sdk/src/Model/ProfileModel.php on line 164

In order to reproduce :

namespace App\Client;

use Klaviyo\Klaviyo as KlaviyoSDK;
use Klaviyo\Model\ProfileModel as KlaviyoProfile;

class Klaviyo
{
    public function __construct(
        protected KlaviyoSDK $client
    ) {
    }

    public function create($args): void
    {

        $profile = new KlaviyoProfile($args);

        /* @phpstan-ignore-next-line */
        $this->client->publicAPI->identify($profile, true);
    }
}

Thanks 🙏🏼 /Sam

jon-batscha commented 2 years ago

Hey Sam,

Really appreciate you reaching out and bringing this to our attention, I'll look into this.

Cheers, Jon

dano-klaviyo commented 2 years ago

fixed https://github.com/klaviyo/php-klaviyo/releases/tag/2.3.6