Title: JsonSerializable throws warnings in newer PHP · Issue #180 · AuthorizeNet/sample-code-php · GitHub
Open Graph Title: JsonSerializable throws warnings in newer PHP · Issue #180 · AuthorizeNet/sample-code-php
X Title: JsonSerializable throws warnings in newer PHP · Issue #180 · AuthorizeNet/sample-code-php
Description: I'm using PHP 8.x and the lack of a return type :mixed on the various library JsonSerialize functions throws out warnings all over the place when using the lib in newer php. There are a couple of fixes. For newer php, the preferred metho...
Open Graph Description: I'm using PHP 8.x and the lack of a return type :mixed on the various library JsonSerialize functions throws out warnings all over the place when using the lib in newer php. There are a couple of f...
X Description: I'm using PHP 8.x and the lack of a return type :mixed on the various library JsonSerialize functions throws out warnings all over the place when using the lib in newer php. There are a couple ...
Opengraph URL: https://github.com/AuthorizeNet/sample-code-php/issues/180
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JsonSerializable throws warnings in newer PHP","articleBody":"I'm using PHP 8.x and the lack of a return type :mixed on the various library JsonSerialize functions throws out warnings all over the place when using the lib in newer php.\r\n\r\nThere are a couple of fixes. For newer php, the preferred method is to add the :mixed return type on any definitions of JsonSerialize so they are compatible with the interface.\r\n\r\n```\r\n // Json Serialize Code\r\n public function jsonSerialize(): mixed { /* code */ }\r\n\r\n```\r\n\r\nBut you can also add a comment above the function that older version of php will ignore and newer ones will suppress the warning.\r\n\r\ne.g.:\r\n\r\n```\r\n // Json Serialize Code\r\n #[\\ReturnTypeWillChange]\r\n public function jsonSerialize() { /* code */ }\r\n\r\n```\r\n\r\nSee [ReturnTypeWillChange](https://php.watch/versions/8.1/ReturnTypeWillChange)","author":{"url":"https://github.com/scottw-finao","@type":"Person","name":"scottw-finao"},"datePublished":"2024-03-12T19:18:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/180/sample-code-php/issues/180"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b45dc9cc-56f8-475b-a36b-23a1210c4ae1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E71E:3EFEAF:3EFF327:54F5028:69732A0B |
| html-safe-nonce | e412f0eb2f8f4e827a9ca16592b4e0a8b8b7202848582899616eb62cf494c414 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzFFOjNFRkVBRjozRUZGMzI3OjU0RjUwMjg6Njk3MzJBMEIiLCJ2aXNpdG9yX2lkIjoiNDkwMDk3MDA1OTIwMDE0NTkzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 988126e166b5dcc79d31ba286dd9a17d0c584ccccd6f5d4167e4715cdb5eb1d9 |
| hovercard-subject-tag | issue:2182503253 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/AuthorizeNet/sample-code-php/180/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fb12e718647650ea712a4d836a9090f56e38a4a7567a192b48f6bec6c4c36181/AuthorizeNet/sample-code-php/issues/180 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fb12e718647650ea712a4d836a9090f56e38a4a7567a192b48f6bec6c4c36181/AuthorizeNet/sample-code-php/issues/180 |
| og:image:alt | I'm using PHP 8.x and the lack of a return type :mixed on the various library JsonSerialize functions throws out warnings all over the place when using the lib in newer php. There are a couple of f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | scottw-finao |
| hostname | github.com |
| expected-hostname | github.com |
| None | 44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4 |
| turbo-cache-control | no-preview |
| go-import | github.com/AuthorizeNet/sample-code-php git https://github.com/AuthorizeNet/sample-code-php.git |
| octolytics-dimension-user_id | 6014037 |
| octolytics-dimension-user_login | AuthorizeNet |
| octolytics-dimension-repository_id | 34751907 |
| octolytics-dimension-repository_nwo | AuthorizeNet/sample-code-php |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 34751907 |
| octolytics-dimension-repository_network_root_nwo | AuthorizeNet/sample-code-php |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a5e2b48bd1260476599758f5d253b5d24092ab84 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width