sendgrid / sendgrid-php

The Official Twilio SendGrid PHP API Library
https://sendgrid.com
MIT License
1.49k stars 624 forks source link

fix: Suppress deprecation warnings in PHP 8.1 #1066

Closed andreas-aeschlimann closed 2 years ago

andreas-aeschlimann commented 2 years ago

In PHP 8.1, we need to add the mixed return type to the jsonSerialize implementation. The mixed return type is not supported in older versions. It is possible to suppress the deprecation warning by adding a PHP attribute. Older PHP versions will interpret attributes as a comment.

andreas-aeschlimann commented 2 years ago

@thinkingserious any chance this is going to be reviewed?

It's a very easy fix, backward compatible and will enable everyone to use SendGrid without errors on PHP 8.1.

andreas-aeschlimann commented 2 years ago

Thanks!