Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 throws Deprecation errors relating to jsonSerialize #1070

Closed
madhancock opened this issue Dec 8, 2021 · 2 comments
Closed

PHP 8.1 throws Deprecation errors relating to jsonSerialize #1070

madhancock opened this issue Dec 8, 2021 · 2 comments

Comments

@madhancock
Copy link

Issue Summary

PHP 8.1 throws Deprecation errors for this package.

Steps to Reproduce

Use in PHP 8.1

Exception/Log

Example (occurs in all occurrences of jsonSerialize):

Deprecated: Return type of SendGrid\Mail\Content::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Technical details:

  • sendgrid-php version: 7.11
  • php version: 8.1

Suggested Fix

There is a temporary fix of adding the #[\ReturnTypeWillChange] annotation to the methods.

The long term fix would be to correctly specify the return type. This will require a major release as it will lock out PHP version prior to PHP 8.1.

@madhancock
Copy link
Author

#1066 applies the temporary backwards compatible fix for the issue.

@andreas-aeschlimann
Copy link
Contributor

The PR has been merged as they saw my comment. I think you can close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants