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.2 compatible error: Return type of Rollbar\Payload\Notifier::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed #11

Open
djgoswami opened this issue Dec 26, 2023 · 5 comments

Comments

@djgoswami
Copy link

This works fine for PHP 8.2 but only return one below error.

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

@djgoswami
Copy link
Author

Solution:

We can adjust the return type in the Notifier class to match the required return type by implementing the JsonSerializable interface correctly.

We need to update vendor/rollbar/rollbar/src/Payload/Notifier.php class at line no.48

From public function jsonSerialize() to public function jsonSerialize(): mixed

Can anybody update this change in this package?

@baibaratsky
Copy link
Owner

@djgoswami Create a pull request please

@djgoswami
Copy link
Author

@baibaratsky Shall I create a new branch from master for this bug and then commit changes of vendor/rollbar/rollbar/src/Payload/Notifier.php file? Please guide me.

@TaQba
Copy link

TaQba commented Mar 13, 2024

Hello,
Can some apply this change please?

@baibaratsky
Copy link
Owner

Sure, usual process: fork the repo, fix the file, and send a pull request please.

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

3 participants